首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在手机中发送otp时,颤动OTP不工作

在手机中发送otp时,颤动OTP不工作
EN

Stack Overflow用户
提问于 2021-06-09 01:45:33
回答 1查看 66关注 0票数 0

我正在尝试使用Flutter otp https://pub.dev/packages/flutter_otp发送动态口令。我并不期待将OTP与Firebase Auth一起发送。当用户通过我的应用程序传递电话号码时,我希望发送一个动态口令并验证它。但是我遇到了这个Flutter_otp,它不需要firebase,它的依赖项只有https://pub.dev/packages/sms和flutter。下面是我想测试是否发送了OTP的代码片段。

代码语言:javascript
复制
import 'package:flutter/material.dart';
import 'package:flutter_otp/flutter_otp.dart';

class MyAppextends StatefulWidget {

  @override
  _MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
  const MyPailaApp({Key key}) : super(key: key);
  TextEditingController _controller = new TextEditingController();
  FlutterOtp otpsender = new FlutterOtp();

  @override
  void dispose() {
     super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 16.0),
      child: TextField(
          cursorColor: Colors.black,
          controller: _controller,
          decoration: InputDecoration(
            hintText: 'Tap to type',
            suffixIcon: IconButton(
              icon: Icon(Icons.send, color: Colors.black,),
              onPressed: (){
                setState(() {
                  otpsender.sendOtp(_controller.text, 'OTP is : pass the generated otp here ',
                        100000, 999999, '+977');
                  _controller.clear();
                });
              },
            ),
          ),
      ),
    );
  }
}

但在单击文本字段中的图标后,我收到以下错误,并且OTP也未发送。

代码语言:javascript
复制
Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety
Debug service listening on ws://127.0.0.1:57564/Qnt0yPHy_eA=/ws
Error: MissingPluginException(No implementation found for method sendSMS on channel plugins.babariviere.com/sendSMS)
    at Object.throw_ [as throw] (http://localhost:58819/dart_sdk.js:5348:11)
    at MethodChannel._invokeMethod (http://localhost:58819/packages/flutter/src/services/system_channels.dart.lib.js:962:21)
    at _invokeMethod.next (<anonymous>)
    at http://localhost:58819/dart_sdk.js:39230:33
    at _RootZone.runUnary (http://localhost:58819/dart_sdk.js:39087:58)
    at _FutureListener.thenAwait.handleValue (http://localhost:58819/dart_sdk.js:34073:29)
    at handleValueCallback (http://localhost:58819/dart_sdk.js:34633:49)
    at Function._propagateToListeners (http://localhost:58819/dart_sdk.js:34671:17)
    at _Future.new.[_completeWithValue] (http://localhost:58819/dart_sdk.js:34513:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:58819/dart_sdk.js:34536:35)
    at Object._microtaskLoop (http://localhost:58819/dart_sdk.js:39374:13)
    at _startMicrotaskLoop (http://localhost:58819/dart_sdk.js:39380:13)
    at http://localhost:58819/dart_sdk.js:34887:9

======== Exception caught by services library ======================================================
The following MissingPluginException was thrown while activating platform stream on channel plugins.babariviere.com/statusSMS:
MissingPluginException(No implementation found for method listen on channel plugins.babariviere.com/statusSMS)

When the exception was thrown, this was the stack: 
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 236:49  throw_
packages/flutter/src/services/platform_channel.dart 156:7                                                                  _invokeMethod
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1613:54                                          runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 155:18                                    handleValue
...
====================================================================================================

请帮我弄一下这个。

EN

回答 1

Stack Overflow用户

发布于 2021-06-09 19:31:06

网站不支持您正在使用的包。

同样的方法应该只适用于Android和iOS。

错误消息MissingPluginException(No implementation found for method listen on channel plugins.babariviere.com/statusSMS)正在尝试传达这一点。

我们可以看到,pub.dev上的所有插件都显示了它们支持的平台,你想要使用的两个插件在Web上都不支持,只有iOS和安卓支持

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

https://stackoverflow.com/questions/67892115

复制
相关文章

相似问题

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