- MissingPluginException(找不到方法的实现 *
Screenshot(调试时相同的代码工作)
class MainActivity: FlutterActivity() {
private val channelName = "Toast" ;
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
var channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger , channelName);
channel.setMethodCallHandler{call , result-> if(call.method=="showToast"){
Toast.makeText(this , "toast" , Toast.LENGTH_LONG).show()
} }
}
}
字符串
1条答案
按热度按时间pw9qyyiw1#
关闭编辑器上运行的应用,运行此命令Flutter clear,然后运行flutter pub get以再次获取所有依赖项,并在设备上运行应用即可。