Pa4bloo
Pa4bloo

Reputation: 1

how to properly use the method isSignedIn() from google_sign_in.dart in flutter/dart

I dont know how to call in the right way a a method called isSignedIn() defined in [google_sign_in.dart]

May you help me with how to call this method in correct way? I am logged in an I would like to run in onPressed in RaisedButton and display result on console.

what I tried was:

RaisedButton(
  child: const Text('REFRESH'),
  onPressed: () {
    print(_googleSignIn.isSignedIn());
  },
),

but I got I/flutter ( 4093): Instance of 'Future<bool>' on console.

Thx a lot. P.

Upvotes: 0

Views: 751

Answers (1)

Jay Mungara
Jay Mungara

Reputation: 7148

First of all _googleSignIn.isSignedIn() is a future bool value. So, try using it with async keywords.

RaisedButton(
  child: const Text('REFRESH'),
  onPressed: () async {
    bool isSignedIn = await _googleSignIn.isSignedIn();
    print(isSignedIn);
  },
),

This way you can check whether you are signed in or not using google.

Upvotes: 2

Related Questions