We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code to reproduce:
import 'package:fresh/fresh.dart'; class InMemoryDelayed extends InMemoryTokenStorage<String> { @override Future<String?> read() async { await Future<dynamic>.delayed(Duration.zero); return super.read(); } } class Foo with FreshMixin<String> { Foo(InMemoryDelayed tokenStorage) { this.tokenStorage = tokenStorage; } } void main() async { var storage = InMemoryDelayed(); await storage.write('token'); var foo = Foo(storage); var token = await foo.token; print(token); // prints null, but should print 'token' }
The token method is not waiting for the first read from storage to complete.
token
https://github.com/felangel/fresh/blob/master/packages/fresh/lib/src/fresh.dart#L110 this line can be changed to await authenticationStatus.firstWhere((status) => status != AuthenticationStatus.initial);
await authenticationStatus.firstWhere((status) => status != AuthenticationStatus.initial);
I can put up a PR if you think this fix is appropriate.
The text was updated successfully, but these errors were encountered:
Fix: Wait for the status to be determined (authenticated or unauthent…
521b8ba
…icated) before returning the token This fix allows initial token to be fetched asynchronously. See felangel#70 for a snippet describing the issue
I ran into the same problem yesterday.
Sorry, something went wrong.
Hey @felangel Could you take a look at the issue and PR? Probably it's just matter of pressing of merge button
merge
Closed by #96
No branches or pull requests
Code to reproduce:
The
token
method is not waiting for the first read from storage to complete.https://github.com/felangel/fresh/blob/master/packages/fresh/lib/src/fresh.dart#L110 this line can be changed to
await authenticationStatus.firstWhere((status) => status != AuthenticationStatus.initial);
I can put up a PR if you think this fix is appropriate.
The text was updated successfully, but these errors were encountered: