小编Dev*_*ara的帖子

Flutter 应用程序在 iOS 平台的 firebase 电话身份验证中崩溃

我已经在我的项目中实现了 Firebase 电话身份验证,

在 android 端一切正常,但对于 iOS 端,当我尝试从我的端发送验证码时,应用程序崩溃并失去连接。

我已经在下面提交了我的代码。

main.dart

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
        home: new MyHomePage(),
        routes: <String, WidgetBuilder> {
          '/homepage': (BuildContext context) => MyApp(),
          '/landingpage': (BuildContext context) => MyHomePage()
        }
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String phoneNo;
  String smsCode;
  String verificationId;

  Future<void> verifyPhone() async {
    print("main");
    final PhoneCodeAutoRetrievalTimeout autoRetrieve = (String verId) {
      print("varification …
Run Code Online (Sandbox Code Playgroud)

iphone ios firebase firebase-authentication flutter

5
推荐指数
1
解决办法
2284
查看次数

dart 中是否有用于单个 if 条件的三元运算符?

在 Dart 中,我们有很多三元运算符。但是我们有一个三元运算符专门用于 if 条件吗?

例子

状况良好

if (num == 1){
  print(true);
} else {
  print(false);
}
Run Code Online (Sandbox Code Playgroud)

三元系

print(num == 1 ? true : false);
Run Code Online (Sandbox Code Playgroud)

那么,我们是否有像上面的示例那样仅针对真实条件的三元运算符?

if (num == 1) {
   print(true);
}
Run Code Online (Sandbox Code Playgroud)

if-statement conditional-statements dart flutter

4
推荐指数
1
解决办法
1966
查看次数