removeStringValue method

Future<bool> removeStringValue(
  1. String insightId
)

Implementation

Future<bool> removeStringValue(String insightId) async {
  final Map<String, List<String>> value = await getAll();
  bool needNotify = false;
  for (final String barcode in value.keys) {
    final List<String> insights = value[barcode] ?? <String>[];
    if (insights.contains(insightId)) {
      value[barcode]!.remove(insightId);
      needNotify = true;
      break;
    }
  }
  if (needNotify) {
    await _getBox().put(_key, value);
    localDatabase.notifyListeners();
    return true;
  }
  return false;
}