小编Ars*_*aev的帖子

未处理的异常:MissingPluginException(在通道 it.example.watch 上找不到方法 flutterToWatch 的实现)

我正在使用Awesome_notifications库,并防止它在 AppDelegate 中使用,例如MissingPluginException(在通道 plugins.flutter.io/shared_preferences 上找不到方法 getAll 的实现) :

SwiftAwesomeNotificationsPlugin.setPluginRegistrantCallback { registry in
          SwiftAwesomeNotificationsPlugin.register(
            with: registry.registrar(forPlugin: "io.flutter.plugins.awesomenotifications.AwesomeNotificationsPlugin")!)          
          FLTSharedPreferencesPlugin.register(
            with: registry.registrar(forPlugin: "io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin")!)
      }
Run Code Online (Sandbox Code Playgroud)

但我的自定义通道仍然有错误: 未处理的异常:MissingPluginException(在通道 it.example.watch 上找不到方法 flutterToWatch 的实现) 而且我不知道如何像 Awesome_notifications 那样在后台注册它。

我的频道:

private func initFlutterChannel() {
        if let controller = window?.rootViewController as? FlutterViewController {
            let channel = FlutterMethodChannel(
                name: "it.example.watch",
                binaryMessenger: controller.binaryMessenger)
            
            channel.setMethodCallHandler({ [weak self] (
                call: FlutterMethodCall,
                result: @escaping FlutterResult) -> Void in
                switch call.method {
                case "flutterToWatch":
                    guard let watchSession = self?.session, watchSession.isPaired, watchSession.isReachable, let methodData …
Run Code Online (Sandbox Code Playgroud)

flutter

26
推荐指数
4
解决办法
8万
查看次数

警告:“onCreateView”总是返回非空类型

今天我在我所有的片段中发现了这个警告:

警告:(45, 12) 'onCreateView' 总是返回非空类型

onCreateView:

override fun onCreateView(inflater: LayoutInflater,
    container: ViewGroup?,
    savedInstanceState: Bundle?): View? {
    ...
}
Run Code Online (Sandbox Code Playgroud)

问题是,发生了什么变化,为什么?

Android Studio 版本 - 4.1.1。

android kotlin android-studio

8
推荐指数
1
解决办法
465
查看次数

标签 统计

android ×1

android-studio ×1

flutter ×1

kotlin ×1