signOut static method

Future<void> signOut()

Signs the user out of Google and disconnects the app.

Implementation

static Future<void> signOut() async {
  try {
    await googleSignIn?.disconnect();
    await googleSignIn?.signOut();
  } catch (error) {
    debugPrint('Failed to sign out or disconnect from Google. $error');
  } finally {
    // Clear all state regardless of success or failure.
    googleSignIn = null;
    if (_instance != null) {
      _instance!.isAuthenticated = false;
      _instance = null;
    }
    debugPrint('User signed out from Google Drive.');
  }
}