Closed jason-dgio closed 4 years ago
Sure, that shouldn't have been there, I'll amend
Sent from ProtonMail mobile
-------- Original Message -------- On 3 Nov 2019, 20:39, Polina Cherkasova wrote:
@polina-c commented on this pull request.
In lib/src/FauiLocalStorage.dart:
- FauiUser user = FauiUser.fromJson(jsonDecode(v));
- if (user == null || user.refreshToken == null) {
- print("sso: no refresh token found");
- return;
- }
- user = await FbConnector.refreshToken(user: user, apiKey: apiKey);
- _storeLocally(_LocalKey, jsonEncode(user));
- FauiAuthState.user = user;
- print("sso: succeeded silent sign-in");
- return;
- FauiUser user = FauiUser.fromJson(jsonDecode(v));
- if (user == null || user.refreshToken == null) {
- print("sso: no refresh token found");
- return;
It seems second print will never happen.
In lib/src/FauiLocalStorage.dart:
print("sso: started silent sign-in");
try {
- await _initialize();
- FauiUtil.throwIfNullOrEmpty(value: apiKey, name: "apiKey");
- String v = _getLocalValue(_LocalKey);
- if (v == null || v == "null") {
- print("sso: no user stored");
- return;
- }
- await _getLocalValue(_LocalKey).then((String v) async {
If you use the keyword 'await', you do not need 'then'. Next statement will wait for this statement to finish. There are two styles to manage asynchrony: (1) with 'then' and (2, more modern) with async/await/Future. In Faui I use the second way.
See more details here: https://dart.dev/codelabs/async-await.
Can you remove 'then', please?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
shared_preferences is a plugin. Flutter web does not support plugins yet. Holding this PR till plugin support.
…with the official shared-preferences dependency