Flutter Pubnub 版本解决失败

Posted

技术标签:

【中文标题】Flutter Pubnub 版本解决失败【英文标题】:Flutter Pubnub version solving failed 【发布时间】:2021-07-25 01:09:27 【问题描述】:

当我将pubnub: ^1.4.4 添加到 pubspec.yaml 时出现此异常

因为 pubnub >=1.0.2 =1.0.2

我已经尝试降低每个库的版本,但还是不行。

这是我的完整 pubspec.yaml

name: mytest_flutter
description: A new Flutter project.

publish_to: "none"
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  provider: ^5.0.0
  http: ^0.13.1
  flutter_staggered_grid_view: ^0.4.0
  carousel_slider: ^3.0.0
  countdown_flutter: ^0.1.2
  intl: ^0.17.0
  percent_indicator: ^3.0.1
  custom_refresh_indicator: ^0.9.0
  material_design_icons_flutter: ^4.0.5955
  flutter_spinkit: ^5.0.0
  image_picker: ^0.7.4
  firebase_ml_vision: ^0.11.0+2
  firebase_core: ^1.0.3
  cached_network_image: ^3.0.0
  font_awesome_flutter: ^9.0.0
  cloud_firestore: ^1.0.4
  url_launcher: ^6.0.3
  rflutter_alert: ^2.0.2
  shared_preferences: ^2.0.5
  smooth_star_rating: ^1.1.1
  share: ^2.0.1
  flutter_html: ^1.3.0
  dio: ^4.0.0
  flutter_tags: ^0.4.9+1
  package_info: ^2.0.0
  smart_select: ^4.3.2
  google_maps_flutter: ^2.0.3
  geolocator: ^7.0.3
  timeago: ^3.0.2
  firebase_storage: ^8.0.5
  firebase_messaging: ^9.1.3
  fl_chart: ^0.36.0
  webview_flutter: ^1.0.7
  pubnub: ^1.4.4

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: ^0.9.0

flutter:
  uses-material-design: true

  assets:
    - assets/images/
flutter_icons:
  android: true
  image_path_android: "assets/images/logo.png"
  ios: true
  image_path_ios: "assets/images/logo.png"

【问题讨论】:

尝试在没有版本的情况下添加pubnub: 【参考方案1】:

根据 PubNub 工程

这是pubnub 包的一个非常过时的版本。目前我们正在使用 3.x,即将发布 4.x 一般来说,您始终可以使用依赖项覆盖解决 Dart 的此类问题

【讨论】:

【参考方案2】:

如果您更新了最新版本。也许是错误版本。你可以使用

  provider: 
  http: 
  flutter_staggered_grid_view: 
  carousel_slider:
  countdown_flutter: 
  intl: 
  percent_indicator: 
  custom_refresh_indicator: 
  material_design_icons_flutter:
  flutter_spinkit: 
  image_picker: 
  firebase_ml_vision:
  firebase_core: 
  cached_network_image:
  font_awesome_flutter: 
  cloud_firestore: 
  url_launcher: 
  rflutter_alert:
  shared_preferences:
  smooth_star_rating:
  share:
  flutter_html: 
  dio: 
  flutter_tags: 
  package_info:
  smart_select: 
  google_maps_flutter: 
  geolocator: 
  timeago:
  firebase_storage: 
  firebase_messaging: 
  fl_chart: 
  webview_flutter: 
  pubnub:

然后颤抖着去酒吧。它适合你。

【讨论】:

以上是关于Flutter Pubnub 版本解决失败的主要内容,如果未能解决你的问题,请参考以下文章

flutter web如何解决pub升级失败(1)?

Android项目创建Flutter module后运行编译失败问题

Android项目创建Flutter module后运行编译失败问题

如何在 Flutter 中消费 PubNub 聊天消息?

在flutter中使用pubnub,如何发起聊天?

在 Flutter 中,如何将文件上传到 PubNub 频道?