future property
Obtains the Future
associated with a FutureProvider.
The instance of Future
obtained may change over time, if the provider
was recreated (such as when using Ref.watch).
This provider allows using async
/await
to easily combine
FutureProvider 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
@override
// ignore: deprecated_member_use_from_same_package
late final AlwaysAliveRefreshable<Future<T>> future = _future(this);