add method

Future<void> add(
  1. String key,
  2. String string
)

Adds a unique value to the end. Removes is before if it pre-existed.

Implementation

Future<void> add(String key, String string) async {
  final List<String> value = getAll(key);
  value.remove(string);
  value.add(string);
  final int? maxLength = _maxLengths[key];
  if (maxLength != null) {
    while (value.length > maxLength) {
      value.removeAt(0);
    }
  }
  await _getBox().put(key, value);
  localDatabase.notifyListeners();
}