小编M4X*_*4X_的帖子

Flutter Firebase Auth:发生网络错误(例如超时、连接中断或主机无法访问)

我正在尝试使用firebase_auth.

但是,每当我调用时,verifyPhoneNumber("+256XXXXXXXXXX")我都会收到A network error (such as timeout, interrupted connection or unreachable host) has occurred.来自PhoneVerificationFailed回调的错误消息。出于这个原因,无法收到短信。

我试过了;

  1. 将如下所示的网络权限添加到我的文件中(我的互联网连接正常,因为我可以通过模拟器使用 Google)

    <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

  2. 检查我的 API 密钥的有效性

我很困惑为什么 Flutter 无法与 firebase 通信。我有两个问题。

  1. 我怎样才能消除这个错误?
  2. 除了缺乏互联网连接外,还有哪些其他情况可能会导致此错误?

我的implimentatioin如下;

import 'package:firebase_auth/firebase_auth.dart';

FirebaseAuth auth = FirebaseAuth.instance;

var message;
// fire this when Phone verification is completed
 final PhoneVerificationCompleted verificationCompleted =
      (AuthCredential phoneAuthCredential) {
    auth.signInWithCredential(phoneAuthCredential);

    message = 'Received phone auth credential: $phoneAuthCredential';
    print(message);
  };

// fire this when Phone …
Run Code Online (Sandbox Code Playgroud)

dart firebase firebase-authentication flutter

6
推荐指数
5
解决办法
5648
查看次数

将盒装数组转换为普通数组?

假设我有一个盒装数组,例如;

\n
\xe2\x94\x8c\xe2\x94\x80\xe2\x94\xac\xe2\x94\x80\xe2\x94\xac\xe2\x94\x80\xe2\x94\x90\n\xe2\x94\x821\xe2\x94\x822\xe2\x94\x823\xe2\x94\x82\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\xb4\xe2\x94\x80\xe2\x94\xb4\xe2\x94\x80\xe2\x94\x98\n
Run Code Online (Sandbox Code Playgroud)\n

如何将其转换为普通数组,例如1 2 3

\n

j

2
推荐指数
1
解决办法
188
查看次数

标签 统计

dart ×1

firebase ×1

firebase-authentication ×1

flutter ×1

j ×1