[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)

解决方案:

1.在flutter引入

shared_preferences: ^2.0.6
 
2.Add this code in your MainActivity
import android.content.Context
import android.os.Bundle
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin
import io.flutter.plugins.videoplayer.*

class MainActivity : FlutterActivity() {

override fun configureFlutterEngine(@NonNull flutterEngine: 
 FlutterEngine) {
    super.configureFlutterEngine(flutterEngine)
    flutterEngine.getPlugins().add(SharedPreferencesPlugin())
    flutterEngine.getPlugins().add(VideoPlayerPlugin())

}
}

 

[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)

上一篇:Windows 7远程桌面连接Ubuntu 16.04


下一篇:ECMAScript 2021 正式确认