gpt4 book ai didi

flutter - 将shared_preferences添加到flutter应用程序时出现错误

转载 作者:行者123 更新时间:2023-12-02 19:48:54 25 4
gpt4 key购买 nike

我创建了新的 flutter 项目以及 androidx 支持并尝试添加共享首选项 0.5.4+3。当我调用 get 命令时。它给出的消息类似于插件 shared_preferences 要求您的应用程序迁移到 Android 嵌入 v2。按照 https://flutter.dev/go/android-project-migration 上的步骤操作并重新运行此命令。

当我进行上述更改时,应用程序未启动并给出如下错误。

.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.4+3/android/src/main/java/io/flutter/plugins/sharedpreferences/SharedPreferencesPlugin.java:25: warning: [deprecation] getFlutterEngine() in FlutterPluginBinding has been deprecated
setupChannel(binding.getFlutterEngine().getDartExecutor(), binding.getApplicationContext());

最佳答案

只需更改或添加您的 pubspec.yaml 文件

shared_preferences: ^0.5.3+5

关于flutter - 将shared_preferences添加到flutter应用程序时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58706496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com