You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter中无法使用google_sign_in插件的问题求助

Flutter中无法使用google_sign_in插件的问题求助

各位大佬好!我最近在自己的Flutter项目里尝试集成google_sign_in登录功能,但是碰到了问题,先把我目前写的登录相关代码贴出来,麻烦帮我看看哪里有问题:

final GoogleSignIn _googleSignIn = GoogleSignIn(
  scopes: [
    'email',
    'profile',
  ],
);

String? _accessToken;
String? _refreshToken;
GoogleSignInAccount? _user;

String? get token => _accessToken;

bool get isAuthenticated => _accessToken != null;

Future<void> signInWithGoogle() async {
  try {
    final account = await _goog

(注:刚才代码没写完,实际是在调用谷歌登录的相关方法时出了状况——要么登录弹窗根本不弹出,要么能弹出但登录后拿不到accessToken,总之没法正常走完登录流程)

我已经在pubspec.yaml里添加了google_sign_in的依赖,也照着官方文档做了基础配置,但还是没解决问题,有没有过来人能给我点排查方向或者解决建议呀?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 12:58:13