android - 没有 Firebase 的 flutter 中的 OTP 验证

标签 android ios flutter

使用 firebase flutter 使用电子邮件和密码注册新用户后。有没有办法在没有firebase电话身份验证的情况下验证他的电话号码,这样同一用户就不会用电子邮件/密码和电话号码注册(我想用他的电子邮件和密码注册他一次并验证他的电话号码)?

最佳答案

你可以试试 flutter_otp 包我认为这是最好的选择,
您可以访问https://pub.dev/packages/flutter_otp欲了解更多信息,
试试下面的例子

import 'package:flutter/material.dart';
import 'package:flutter_otp/flutter_otp.dart';

// Now instantiate FlutterOtp class in order to call sendOtp function
FlutterOtp otp = FlutterOtp();
class SendOtp extends StatelessWidget {
   String phoneNumber = "93XXXXXXXX"; //enter your 10 digit number
   int minNumber = 1000;
   int maxNumber = 6000;
   String countryCode ="+91"; // give your country code if not it will take +1 as default


 @override
 Widget build(BuildContext context) {
   return Scaffold(
    appBar: AppBar(title: Text("send otp using flutter_otp ")),
    body: Container(
      child: Center(
        child: RaisedButton(
         child: Text("Send"),
         onPressed: () {
           // call sentOtp function and pass the parameters

        otp.sendOtp(phoneNumber, 'OTP is : pass the generated otp here ',
            minNumber, maxNumber, countryCode);
      },
    )),
  ),
);
}
}

关于android - 没有 Firebase 的 flutter 中的 OTP 验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63487991/

相关文章:

http - Dart 2.1 中的 HTTP 包发生了什么?

java - RecyclerView 反向无限滚动

android - 如何将位图覆盖在另一个位图上

ios - APNs 在 iOS 8.0 和更高版本中使用 UIUserNotificationSettings 时不起作用

ios - 在 Objective-C 中使用正则表达式获取错误范围

flutter - 第一次将字体导入pubspec.yaml文件中,并且效果很好,两天后字体家族中的相同代码出现错误

android - 使用 fragment 更改为横向时 map 行为会发生变化

java - Android tabhost 问题...包含代码

iphone - AIR - 在 iPhone 上输入文本字段时出现 StageWebView 问题

Flutter,尝试使用 getter 来总结映射中的元素