【问题标题】:Flutter: Error: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/package_info)Flutter:错误:MissingPluginException(在通道 plugins.flutter.io/package_info 上找不到方法 getAll 的实现)
【发布时间】:2021-07-18 14:46:19
【问题描述】:

我最近更新到 Flutter v2 并想在 Chrome 中启动我的应用程序。我尝试了一切来修复错误,但没有任何帮助。


整个例外:

错误:MissingPluginException(在通道 plugins.flutter.io/package_info 上找不到方法 getAll 的实现) 在 Object.throw_ [as throw] (http://localhost:59662/dart_sdk.js:5355:11) 在 MethodChannel._invokeMethod (http://localhost:59662/packages/flutter/src/services/system_channels.dart.lib.js:962:21) 在_invokeMethod.next() 在 http://localhost:59662/dart_sdk.js:39215:33 在 _RootZone.runUnary (http://localhost:59662/dart_sdk.js:39072:58) 在 _FutureListener.thenAwait.handleValue (http://localhost:59662/dart_sdk.js:34058:29) 在 handleValueCallback (http://localhost:59662/dart_sdk.js:34618:49) 在 Function._propagateToListeners (http://localhost:59662/dart_sdk.js:34656:17) 在 _Future.new.[_completeWithValue] (http://localhost:59662/dart_sdk.js:34498:23) 在 async._AsyncCallbackEntry.new.callback (http://localhost:59662/dart_sdk.js:34521:35) 在 Object._microtaskLoop (http://localhost:59662/dart_sdk.js:39359:13) 在 _startMicrotaskLoop (http://localhost:59662/dart_sdk.js:39365:13) 在 http://localhost:59662/dart_sdk.js:34872:9

它在我的 IOS 模拟器上运行良好。

【问题讨论】:

    标签: flutter dart flutter-dependencies flutter-web


    【解决方案1】:
    Future.delayed(const Duration(milliseconds: 500), () {
      setState(() {
        // Here you can write your code for open new view
      });
    });
    

    只需添加一些延迟,然后在 setState() 中执行您的 Provider 或 Async 工作,您的问题就会得到解决

    【讨论】:

    • 我应该在打开新视图的任何地方添加此代码吗?
    • 我将我的代码发布为答案,因为它太长了。
    【解决方案2】:

    我在打开视图之前按照你说的添加了它。

    new ListTile(
                                title: new Text("Favoriten"),
                                trailing: new Icon(Icons.favorite,
                                    color: accentColor, size: 18),
                                onTap: () {
    
                                  Future.delayed(const Duration(milliseconds: 500), () {
                                    setState(() {
                                      Navigator.of(context).pop();
                                      Navigator.of(context).push(new MaterialPageRoute(
                                          builder: (BuildContext context) => Favourite(
                                              unfilteredCars, carProvider, this)));
                                    });
                                  });
    
                                }),
    

    【讨论】:

      猜你喜欢
      • 2020-04-14
      • 2023-02-15
      • 2021-04-23
      • 2018-11-14
      • 2021-02-01
      • 1970-01-01
      • 2022-08-18
      • 2023-01-23
      • 2020-10-20
      相关资源
      最近更新 更多