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.');
  }
}