deleteSync method
- K id
Deletes the data with the specified ID.
Throws an exception if the data with the given ID does not exist.
Returns the ID of the deleted data.
Implementation
K deleteSync(K id) {
final file = File('${directory.path}/$id.json');
if (!file.existsSync()) {
throw Exception('Data with ID $id does not exist.');
}
file.deleteSync();
return id;
}