future property
Refreshable<Future<ValueT> >
get
future
Obtains the Future representing this provider.
The instance of Future obtained may change over time. This typically happens when a new "data" or "error" is emitted, or when the provider re-enters a "loading" state.
This modifier enables using async
/await
to easily combine
providers together:
final configsProvider = FutureProvider((ref) async => Configs());
final productsProvider = FutureProvider((ref) async {
// Wait for the configurations to resolve
final configs = await ref.watch(configsProvider.future);
// Do something with the result
return await http.get('${configs.host}/products');
});
Implementation
Refreshable<Future<ValueT>> get future;