gpt4 book ai didi

flutter - 在flutter中使用notifier 1.0.2插件后的错误信息

转载 作者:行者123 更新时间:2023-12-04 10:37:56 27 4
gpt4 key购买 nike

我正在寻找 Broadcast receiver 的替代品在 flutter 中,我得到了一个插件 notifier 1.0.2添加到我的 pubspec.yaml 后收到一条错误消息,如

Because every version of notifier depends on synchronized ^1.5.3+2 and sqflite 1.2.0 depends on synchronized >=2.0.2 <4.0.0, notifier is incompatible with sqflite 1.2.0.

So, because Bluis depends on both sqflite 1.2.0 and notifier 1.0.2, version solving failed.
pub get failed (1; So, because Bluis depends on both sqflite 1.2.0 and notifier 1.0.2, version solving failed.)
Process finished with exit code 1

这是我的 pubspec.yaml
name: Bluis
description: A new Flutter project.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
sdk: ">=2.2.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter


# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
rxdart: ^0.22.3
http: ^0.12.0+1
toast: ^0.1.5
sqflite: 1.2.0
intl: ^0.16.0
geolocator: ^5.1.4+2
flutter_compass: ^0.3.4
url_launcher: ^5.2.5
permission_handler: ^4.0.0
camera: ^0.5.2+1
video_player: ^0.10.0
path_provider: ^1.1.0
path: ^1.6.2
e2e: ^0.2.0
esys_flutter_share: ^1.0.2
shared_preferences: ^0.5.4+5
connectivity: ^0.4.5+3
uuid: ^2.0.4
logger: ^0.6.0
event_bus: ^1.1.0
location: ^2.3.4
dio: ^3.0.8
recase: ^3.0.0
flutter_map:
git:
url: git://github.com/okaxaki/flutter_map.git
ref: fix/support-flutter-1.10



dev_dependencies:
flutter_test:
sdk: flutter
notifier: 1.0.2

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
- assets/locale/localization_en.json
- assets/locale/localization_hi.json
- assets/locale/localization_or.json

最佳答案

我通过使用 event bus 解决了我的目的

  • 创建事件总线EventBus eventBus = EventBus();
  • 定义事件(使用构造函数创建一个具有事件名称的类)class UserLoggedInEvent {
    User user;
    UserLoggedInEvent(this.user);
    }
  • 注册监听器(监听你的事件)eventBus.on<UserLoggedInEvent>().listen((event) {
    // All events are of type UserLoggedInEvent (or subtypes of it).
    print(event.user);
    });
  • 触发你的事件User myUser = User('Mickey');
    eventBus.fire(UserLoggedInEvent(myUser));
  • 取消您的所有事件eventBus.cancel();
  • 关于flutter - 在flutter中使用notifier 1.0.2插件后的错误信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60076693/

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