I\'m trying to implement local database support in my flutter app which is being managed using Provider, now I want to make the retrieving of data obey the state management patt
FutureProvider
exposes the result of the Future
returned by builder
to its descendants.
As such, using the following FutureProvider
:
FutureProvider(
initialData: 0,
builder: (_) => Future.value(42),
child: ...
)
it is possible to obtain the current value through:
Provider.of(context)
or:
Consumer(
builder: (context, value, __) {
return Text(value.toString());
}
);