首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Flutter:类型为“GoogleSignInAccount?”的值。不能赋值给'GoogleSignInAccount‘类型的变量

Flutter:类型为“GoogleSignInAccount?”的值。不能赋值给'GoogleSignInAccount‘类型的变量
EN

Stack Overflow用户
提问于 2021-06-08 00:36:23
回答 1查看 761关注 0票数 0

我正在尝试将flutter应用程序与firebase google身份验证连接起来。

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 ('!')."

我添加的依赖项为: firebase_auth:^1.3.0 google_sign_in:^5.0.4 firebase_core:^1.2.1

我有gradle 6.7

错误:“无法无条件地访问属性'authentication‘,因为接收方可以为' null’。请尝试使访问具有条件(使用'?.')或向目标(‘!’)添加null检查。”

EN

回答 1

Stack Overflow用户

发布于 2021-06-17 19:48:23

这对我很有效

代码语言:javascript
复制
GoogleSignInAccount? googleSignInAccount = await gooleSignIn.signIn();

添加?就在GoogleSignInAccount之后。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67875522

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档