add method

  1. @override
Future<void> add(
  1. T nextValue, {
  2. bool clearUndo = true,
})
override

Implementation

@override
Future<void> add(T nextValue, {bool clearUndo = true}) async {
  if (_history.length == maxSize) {
    _history.remove(_history.first);
  }
  _history.add(nextValue);
  // if one new is added, the undo is invalid
  if (clearUndo) _undoList.clear();
  await notifyPersistence();
}