initialise static method
Sign in to Google Drive and intialise DriveHelper.
Provide scopes
from DriveScopes, or custom ones by passing strings.
Consider using a FutureBuilder
to
asynchronously await on this method and show a loading screen,
and show an error page if this method fails.
Implementation
static Future<DriveHelper> initialise(List<String> scopes) async {
final signIn = GoogleSignIn.standard(scopes: scopes);
final account = (await signIn.isSignedIn()
? await signIn.signInSilently() ?? await signIn.signIn()
: await signIn.signIn());
// ignore: unnecessary_statements
account == null ? throw "Account authentication failed" : null;
return DriveHelper._construct(
DriveApi(_GoogleAuthClient(await account.authHeaders)),
account,
signIn,
);
}