removeItem method
Deletes a single item from the data store associated with a specific tag.
This method retrieves the data corresponding to the provided tag,
removes the entry identified by the given id, and then saves the
updated data back to the storage.
Parameters:
tag: AStringrepresenting the category or group of data to target.id: AStringrepresenting the unique identifier of the item to be deleted.
Returns:
- A
Future<void>indicating the completion of the delete operation.
Throws:
- Any errors encountered during data loading or saving will propagate.
Implementation
Future<void> removeItem(final String tag, final String id) async {
final Map<String, dynamic> data = await _loadData(tag);
data.remove(id);
await _saveData(tag, data);
}