removeItem method

Future<void> removeItem(
  1. String tag,
  2. String id
)

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: A String representing the category or group of data to target.
  • id: A String representing 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);
}