dart Flutter:错误:MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/package_info)

bbmckpt7  于 2023-09-28  发布在  Flutter
关注(0)|答案(2)|浏览(264)

我最近更新到Flutter v2,并希望在Chrome中启动我的应用程序。我尝试了所有方法来修复这个bug,但没有任何帮助。
整个例外:

Error: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/package_info)
    at Object.throw_ [as throw] (http://localhost:59662/dart_sdk.js:5355:11)
    at MethodChannel._invokeMethod (http://localhost:59662/packages/flutter/src/services/system_channels.dart.lib.js:962:21)
    at _invokeMethod.next (<anonymous>)
    at http://localhost:59662/dart_sdk.js:39215:33
    at _RootZone.runUnary (http://localhost:59662/dart_sdk.js:39072:58)
    at _FutureListener.thenAwait.handleValue (http://localhost:59662/dart_sdk.js:34058:29)
    at handleValueCallback (http://localhost:59662/dart_sdk.js:34618:49)
    at Function._propagateToListeners (http://localhost:59662/dart_sdk.js:34656:17)
    at _Future.new.[_completeWithValue] (http://localhost:59662/dart_sdk.js:34498:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:59662/dart_sdk.js:34521:35)
    at Object._microtaskLoop (http://localhost:59662/dart_sdk.js:39359:13)
    at _startMicrotaskLoop (http://localhost:59662/dart_sdk.js:39365:13)
    at http://localhost:59662/dart_sdk.js:34872:9

它在我的IOS模拟器上运行得非常好。

bttbmeg0

bttbmeg01#

Future.delayed(const Duration(milliseconds: 500), () {
  setState(() {
    // Here you can write your code for open new view
  });
});

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

hkmswyz6

hkmswyz62#

我在打开视图之前添加了它。

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)));
                                });
                              });

                            }),

相关问题