of<T extends CollectionChangeNotifier> static method
Obtains the nearest CollectionProvider<T> up its widget tree and returns its value.
If listen
is true
, later value changes will trigger a new
State.build to widgets, and State.didChangeDependencies for
StatefulWidget.
listen: false
is necessary to be able to call CollectionProvider.of
inside State.initState or the create
method of providers.
Implementation
static T of<T extends CollectionChangeNotifier>(
BuildContext context, {
bool listen = true,
}) =>
Provider.of<T>(context, listen: listen);