flutter
扫描插件scan
1.6.0
https://pub.flutter-io.cn/packages/scan
接入扫描时用到这个插件,我的flutter
版本3.3.0
android
跳转到扫描页面时报错
E/flutter: [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Unexpected platform view context. When constructing a platform view in the factory, use the context from PlatformViewFactory#create, view id: 1
at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:187)
at android.app.Dialog.dispatchOnCreate(Dialog.java:433)
at android.app.Dialog.show(Dialog.java:327)
at android.app.Presentation.show(Presentation.java:279)
解决办法:
https://github.com/flutter-package/flutter_scan/issues/53
回退flutter
版本到3.0.5
或者3.0.2
都可以
查看flutter
路径
which flutter
执行命令的结果是:/Users/xxxx/Library/flutter/bin/flutter
从执行命令的结果中截取/bin/flutter
前的路径,就是flutter SDK的路径
flutter SDK
的路径:/Users/xxx/Library/flutter
cd
到flutter
目录下
cd /Users/xxx/Library/flutter
执行回退 9b2d32b605630f28625709ebd9d78ab3016b2bf6
这个是3.0.5的标记
可以在https://github.com/flutter/flutter/tags 查看你要回退的版本
git reset --hard 9b2d32b605630f28625709ebd9d78ab3016b2bf6
后面正常flutter run
就好了