removeItem method

Future<void> removeItem(
  1. bool matcher(
    1. T
    )
)

Implementation

Future<void> removeItem(bool Function(T) matcher) async {
  final items = await getItems();
  final filtered = items.where((item) => !matcher(item)).toList();
  final prefs = await SharedPreferences.getInstance();
  await prefs.setString(key, jsonEncode(filtered.map(_toJson).toList()));
}