removeItems method
Deletes multiple items from the data store associated with a specific tag.
This method retrieves the data corresponding to the provided tag,
iterates over the list of ids to remove each matching entry, and
then saves the updated data back to the storage.
Parameters:
tag: AStringrepresenting the category or group of data to target.ids: AList<String>containing unique identifiers of the items 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> removeItems(final String tag, final List<String> ids) async {
final Map<String, dynamic> data = await _loadData(tag);
for (int i = 0; i < ids.length; i++) {
final String id = ids[i];
data.remove(id);
}
await _saveData(tag, data);
}