delete<T extends Model> static method

Future<bool> delete<T extends Model>({
  1. required String uuid,
})

Deletes record by UUID.

Implementation

static Future<bool> delete<T extends Model>({required String uuid}) async {
  try {
    final allRecords = await jsonIndex<T>();
    allRecords.removeWhere((record) => record['uuid'] == uuid);
    return await _s3client.putString(
      _getS3TableKey<T>(),
      jsonEncode(allRecords),
      contentType: 'application/json',
      acl: S3Acl.private,
    );
  } catch (e) {
    return false;
  }
}