The getter 'future' isn't defined - n00b alert #3444
-
Beta Was this translation helpful? Give feedback.
Answered by
charlescyt
Mar 23, 2024
Replies: 1 comment 1 reply
-
That's because @riverpod
Future<String> authProvider(AuthProviderRef ref) async {
await Future.delayed(const Duration(seconds: 3));
return 'hello';
} Change the code to @riverpod
Future<String> auth(AuthRef ref) async {
await Future.delayed(const Duration(seconds: 3));
return 'hello';
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
amireldor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's because
authProvider
is not referring to the actual generatedFutureProvider
. It is referring to the functionChange the code to
await ref.watch(authProviderProvider.future);
and it will work.But this is rather confusing having a
ProviderProvider
so generally you wouldn't suffix your provider with provider.