简体   繁体   中英

Flutter: A value of type 'GoogleSignInAccount?' can't be assigned to a variable of type 'GoogleSignInAccount'

I am trying to connect my flutter application with firebase google authentication.

The error states "The property 'authentication' can't be unconditionally accessed because the receiver can be 'null'. Try making the access conditional (using '?.') or adding a null check to the target ('.')."

my added dependencies are: firebase_auth: ^1.3.0 google_sign_in: ^5.0.4 firebase_core: ^1.2.1

and i have gradle 6.7

the error: "The property 'authentication' can't be unconditionally accessed because the receiver can be 'null'. Try making the access conditional (using '?.') or adding a null check to the target ('.')."

This worked for me

GoogleSignInAccount? googleSignInAccount = await gooleSignIn.signIn();

Add? right after GoogleSignInAccount.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM