notifyListeners method
void
notifyListeners()
Notify dependents that this provider has changed.
This is typically used for mutable state, such as to do:
class TodoList extends Notifier<List<Todo>> {
@override
List<Todo>> build() => [];
void addTodo(Todo todo) {
state.add(todo);
ref.notifyListeners();
}
}
Implementation
void notifyListeners() {
_throwIfInvalidUsage();
final currentValue = _element.value;
if (_element._didBuild) {
_element._notifyListeners(
currentValue,
currentValue,
checkUpdateShouldNotify: false,
);
}
}