21 lines
385 B
Dart
21 lines
385 B
Dart
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();
|
|
}
|
|
}
|