我正在做一个项目,在与我的队友合并代码之前,package sms_autofill运行正常,但在代码合并后,我已经运行了Flatter clean,但它仍然显示两个错误,如下所示:
Unhandled Exception: MissingPluginException(No implementation found for method listenForCode on channel sms_autofill)
和
Unhandled Exception: MissingPluginException(No implementation found for method getAppSignature on channel sms_autofill)
我的代码:
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:rentto_tenant/model/auth.dart';
import 'package:rentto_tenant/repository/auth_repository.dart';
import 'package:rentto_tenant/util/exception/ResponseException.dart';
import 'package:rentto_tenant/view/welcome/welcome.dart';
import 'package:rentto_tenant/view/home/home.dart';
import 'package:rentto_tenant/widget/loaders/color_loader_3.dart';
import 'package:rentto_tenant/widget/loaders/color_loader_4.dart';
import 'package:rentto_tenant/widget/loading_widget.dart';
import 'package:sms_autofill/sms_autofill.dart';
import 'package:pin_code_text_field/pin_code_text_field.dart';
import '../../constant/color.dart';
import '../../constant/dimen.dart';
class SMSVerificationPage extends StatefulWidget {
final String uuid;
final String phoneNumber;
final String password;
final String requestType;
const SMSVerificationPage(
{Key key, this.uuid, this.phoneNumber, this.password, this.requestType})
: super(key: key);
@override
_SMSVerificationPageState createState() => _SMSVerificationPageState();
}
class _SMSVerificationPageState extends State<SMSVerificationPage>
with CodeAutoFill {
TextEditingController pinCodeController = new TextEditingController();
TextEditingController autoFillCodeController = new TextEditingController();
_resendCode() async {
_loadingController.startLoading();
try {
String _uuid =
await AuthUserRepository.of(context).resendCode(widget.phoneNumber);
_loadingController.stopLoading();
setState(() {
_codeResent = true;
_codeExpiresInXMin = 5;
});
startTimer();
print(_uuid);
} on ResponseException catch (e) {
print(e.response.statusCode);
print(e.response.body);
} catch (e) {
print(e.toString());
} finally {
_loadingController.stopLoading();
}
}
_verifyCode() async {
_loadingController.startLoading();
try {
AuthUser auth = await AuthUserRepository.of(context).verifyUser(
widget.uuid,
pinCodeController.text,
widget.password,
widget.requestType);
// store Auth Tokens
print(auth.toJson());
// navigate
_loadingController.stopLoading();
if (widget.requestType == "reset_password") {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => HomePage()),
(route) => false);
} else {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => WelcomePage()),
(route) => false);
}
} on ResponseException catch (e) {
_codeErr = true;
print(e.response.statusCode);
print(e.response.body);
} catch (e) {
_codeErr = true;
print(e.toString());
throw (e);
} finally {
_loadingController.stopLoading();
}
}
String appSignature;
String otpCode;
bool _codeErr = false;
bool _codeResent = false;
Timer _timer;
int _codeExpiresInXMin = 5;
void startTimer() {
const oneMin = const Duration(minutes: 1);
_timer = new Timer.periodic(
oneMin,
(Timer timer) => setState(
() {
if (_codeExpiresInXMin < 1) {
timer.cancel();
} else {
_codeExpiresInXMin = _codeExpiresInXMin - 1;
}
},
),
);
}
@override
void codeUpdated() {
setState(() {
otpCode = code;
pinCodeController.text = code;
});
}
@override
void initState() {
startTimer();
listenForCode();
SmsAutoFill().getAppSignature.then((signature) {
setState(() {
appSignature = signature;
});
});
super.initState();
}
@override
void dispose() {
_timer.cancel();
cancel();
super.dispose();
}
final _loadingController = LoadingController();
@override
Widget build(BuildContext context) {
return LoadingWidget(
controller: _loadingController,
child: Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 15.0, bottom: 8.0),
child: Image(
image: AssetImage(
"assets/images/Logo.png",
),
width: 93,
height: 110,
),
),
Container(
margin: EdgeInsets.only(bottom: 30),
child: Text(
"RENTTO",
style: Theme.of(context).textTheme.headline4.copyWith(
color: AppColors.genericColor,
),
textAlign: TextAlign.center,
),
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
"Enter Verifcation code",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline5,
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0),
child: Text(
"If you're having any issue, contact to RENTTO",
textAlign: TextAlign.center,
),
),
Padding(
padding: const EdgeInsets.only(top: 40, bottom: 25),
child: PinCodeTextField(
controller: pinCodeController,
maxLength: 6,
pinBoxWidth: 50,
pinBoxHeight: 50,
pinBoxRadius: 10,
pinBoxBorderWidth: 1,
autofocus: true,
highlight: true,
highlightColor: AppColors.genericColor,
hasError: _codeErr,
errorBorderColor: Colors.red,
pinTextStyle: TextStyle(
color: AppColors.genericColor,
fontSize: 25,
fontWeight: FontWeight.bold),
keyboardType: TextInputType.number,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: _codeResent
? Text(
'OTP Code has been resent! Please fill in the code in ' +
_codeExpiresInXMin.toString() +
' minutes.',
style: TextStyle(
fontSize: 14,
color: AppColors.genericColor,
),
textAlign: TextAlign.center,
)
: Text(
'OTP Code has been sent! Please check your message and fill in the code in ' +
_codeExpiresInXMin.toString() +
' minutes.',
style: TextStyle(
fontSize: 14,
color: AppColors.genericColor,
),
textAlign: TextAlign.center,
),
),
FlatButton(
onPressed: () {
setState(() {
_loadingController.startLoading();
});
_resendCode();
},
child: Text("Resend Code",
style: TextStyle(
fontSize: 17,
color: AppColors.genericColor,
fontWeight: FontWeight.w600)),
),
Padding(
padding: const EdgeInsets.only(top: 30.0, bottom: 30.0),
child: RaisedButton(
padding: EdgeInsets.symmetric(
horizontal: 120, vertical: 15),
onPressed: () {
setState(() {
_loadingController.startLoading();
});
_verifyCode();
},
child: Text(
"CONTINUE",
style: TextStyle(
fontSize: AppDimens.btnTextSize,
),
),
color: AppColors.primaryColors,
),
)
],
),
),
),
),
),
);
}
}
颤振博士-v:
[✓] Flutter (Channel master, 1.21.0-6.0.pre.3, on Linux, locale en_US.UTF-8)
• Flutter version 1.21.0-6.0.pre.3 at /home/veasnawt/Flutter/flutter
• Framework revision ddb8e6e3bf (24 hours ago), 2020-07-22 20:00:07 -0700
• Engine revision dcc9a4048d
• Dart version 2.9.0 (build 2.9.0-21.0.dev 9dca49e71e)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /home/veasnawt/Android/Sdk
• Platform android-30, build-tools 29.0.3
• Java binary at: /snap/android-studio/90/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 3.6)
• Android Studio at /snap/android-studio/88/android-studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Android Studio (version 4.0)
• Android Studio at /snap/android-studio/90/android-studio
• Flutter plugin version 47.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Connected device (4 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• Linux (desktop) • linux • linux-x64 • Linux
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 81.0.4044.129
• No issues found!
pubspec。亚马尔:
name: rentto_tenant
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
flutter_i18n: ^0.18.0
json_annotation: ^3.0.1
http: ^0.12.2
provider: ^4.3.1
flutter_dotenv: ^2.1.0
pin_code_text_field: ^1.2.1
sms_autofill: ^1.2.1
font_awesome_flutter: ^8.8.1
flutter_facebook_login: ^3.0.0
intro_slider: ^2.3.1
fluttertoast: ^7.0.1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.10.0
json_serializable: ^3.3.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- .env
- assets/images/
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
我不知道它有什么问题,我已经尝试在互联网上搜索,似乎没有与之相关的解决方案。在此处输入代码
终于知道问题出在哪里了。
软件包sms_autofill
本身不是问题的原因,问题在于软件包flatter_facebook_login
已安装且未使用。移除或正确使用它将解决问题。
我正在尝试构建Android应用程序,但收到一个错误MissingPluginException(在channel testfairy上找不到方法log的实现): TestFairy插件的当前版本:TestFairy:^2.0。1颤振(通道稳定,1.22.2)Dart版本2.10。2.此外,我还添加了: 我使用命令运行应用程序。 如何解决此错误?
E/flatter(13237):[错误:flatter/lib/ui/ui\u dart\u state.cc(177)]未处理的异常:MissingPluginException(在lyokone/location通道上找不到getLocation方法的实现) 我正在使用位置和地点选择器插件 未处理的异常:平台异常(错误,java.lang.非法状态异常:试图创建未注册类型的平台视图:plug
我有几个插件有问题 Image_Picker:^0.6.2+3,位置:^2.3.5,... 我真的扑得干干净净,什么都没变 Android设备:SM-N900 和我的代码:
未处理的异常:MissingPluginException(在channel Flatter_inapp上找不到方法initConnection的实现)。当我在android上使用Flatter in-app purchase插件时,会出现MissingPluginException异常。在iOS上,它运行得很好 当我运行或调试应用程序时,会出现以下错误:
我刚刚从颤振中复制了代码。dev并对其进行了修改,出现以下错误 E/flatter(2639):[ERROR:flatter/lib/ui/ui\u dart\u state.cc(177)]未处理的异常:MissingPluginException(在通道My channel上找不到方法myNativeFunction的实现)*我想将一条消息从本机java代码打印到Flatter ui*
我得到这个错误时,调用请求权限()方法的Firebase消息。 [错误:flatter/lib/ui/ui_dart_state.cc(209)]未处理的异常:MissingPluginException(未找到方法消息传递的实现#通道插件上的requestPermission.flatter.io/firebase_消息传递)E/flatter(7180):#0 convertPlatformE