freezer/lib/notifiers/list_notifier.dart

21 lines
385 B
Dart
Raw Normal View History

2023-07-29 02:17:26 +00:00
import 'package:flutter/widgets.dart';
class ListNotifier<T> extends ValueNotifier<List<T>> {
ListNotifier(List<T> value) : super(value);
void add(T element) {
value.add(element);
notifyListeners();
}
void remove(T element) {
value.remove(element);
notifyListeners();
}
void clear() {
value.clear();
notifyListeners();
}
}