所有的flutter第三方插件报错:
E/flutter ( 6441): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
E/flutter ( 6441): #0 PathProviderApi.getApplicationDocumentsPath (package:path_provider_android/messages.g.dart:97:7)
E/flutter ( 6441): <asynchronous suspension>
E/flutter ( 6441): #1 getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:115:24)
E/flutter ( 6441): <asynchronous suspension>
E/flutter ( 6441): #2 _FileContainerState.build.<anonymous closure>.<anonymous closure>
package:whatsapp_redesign/…/chat/file_container.dart:56
E/flutter ( 6441): <asynchronous suspension>
解决办法:在Android项目的MainActivity中添加下面的代码:
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)//1、注册插件
}