-
Notifications
You must be signed in to change notification settings - Fork 128
Open
Description
Surely we can do better than this. This has to be one of the most convoluted api's i've ever seen.
The point of an api is to abstract away the details, this api completely fails to do so.
The core point seems to be we aren't sure if the call will return soon or take a long time and therefor we may need to have alternate paths. Can we not more directly provide that information?
From the documentation.
Future<GoogleSignInAccount?>? attemptLightweightAuthentication({bool reportAllExceptions = false})
Type: Future<GoogleSignInAccount?>? Function({bool reportAllExceptions})
package:google_sign_in/google_sign_in.dart
Attempts to sign in a previously authenticated user with minimal interaction.
The amount of allowable UI is up to the platform to determine, but it should be minimal. Possible examples include FedCM on the web, and One Tap on Android. Platforms may even show no UI, and only sign in if a previous sign-in is being restored. This method is intended to be called as soon as the application needs to know if the user is signed in, often at initial launch.
Use [authenticate] instead to trigger a full interactive sign in process.
There are two possible return modes:
If a Future is returned, applications could reasonably await that future before deciding whether to display UI in a signed in or signed out mode. For example, a platform where this method only restores existing sign-ins would return a future, as either way it will resolve quickly.
If null is returned, applications must rely on [authenticationEvents] to know when a sign-in occurs, and cannot rely on receiving a notification that this call has not resulted in a sign-in in any reasonable amount of time. In this mode, applications should assume a signed out mode until/unless a sign-in event arrives on the stream. FedCM on the web would be an example of this mode.
If a Future is returned, it resolves to an instance of [GoogleSignInAccount] for a successful sign in or null if the attempt implicitly did not result in any authentication. A [GoogleSignInException] will be thrown if there was a failure (such as a client configuration error). By default, this will not throw any of the following:
[GoogleSignInExceptionCode.canceled]
[GoogleSignInExceptionCode.interrupted]
[GoogleSignInExceptionCode.uiUnavailable] and will instead return null in those cases. To receive exceptions for those cases instead, set [reportAllExceptions] to true.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels