delete<T extends Model> static method
- required String uuid,
Deletes record by UUID.
Implementation
static Future<bool> delete<T extends Model>({required String uuid}) async {
final file = File("$_dir/${_getTableName<T>()}.json");
if (!await file.exists()) return false;
try {
final allRecords = await jsonIndex<T>();
allRecords.removeWhere((r) => r['uuid'] == uuid);
await file.writeAsString(jsonEncode(allRecords), flush: true);
return true;
} catch (e) {
return false;
}
}