面对 pubspec.yaml 中的问题

时间:2021-05-06 13:35:24

标签: flutter dart pubspec

当我在发布后将库 new_version: ^0.2.0 集成到项目中时,我收到此错误 -

Because new_version >=0.0.7 depends on package_info_plus ^1.0.0 which depends on package_info_plus_platform_interface ^1.0.0, new_version >=0.0.7 requires package_info_plus_platform_interface ^1.0.0.
And because package_info_plus_platform_interface >=1.0.0-nullsafety.1 depends on plugin_platform_interface ^2.0.0 and file_picker 2.1.6 depends on plugin_platform_interface ^1.0.1, new_version >=0.0.7 is incompatible with file_picker 2.1.6.
So, because fstore depends on both file_picker 2.1.6 and new_version ^0.2.0, version solving failed.
pub get failed (1; So, because fstore depends on both file_picker 2.1.6 and new_version ^0.2.0, version solving failed.)

我不明白这个flutter版本问题还是sdk问题是什么意思???

这是 pubspec.yaml 文件,其中所有库都已为项目集成,如果我删除 new_version 库项目将工作得很好。

name: fstore
publish_to: "none"
description: Mobile commerce app by Flutter

# 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: 2.0.0+3001

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # COMMON
  inspireui:
    path: ./modules/common_library
  pedantic: 1.9.2
  rubber:
    git:
      url: git://github.com/inspireui/rubber
  country_pickers:
    git:
      url: git://github.com/inspireui/country_pickers.git


  # FIREBASE PACKAGES
  cloud_firestore: 0.14.4
  firebase_analytics: 6.3.0
  firebase_auth: 0.18.4+1
  firebase_core: 0.5.3
  firebase_database: 4.4.0
  firestore_ui: 1.12.0
  firebase_remote_config: ^0.4.3

  # STATE MANAGEMENT
  provider: 4.3.3

  # UI
  animated_splash: 1.0.0
  animated_text_kit: 3.1.2
  animations: 1.1.2
  awesome_card: 1.1.0
  carousel_pro: 1.0.0
  configurable_expansion_tile: 1.0.0
  country_code_picker: 1.7.0
  custom_splash: 0.0.2
  flare_splash_screen: 3.0.1
  rive: 0.6.8
  flash: 1.3.2
  flutter_spinkit: 4.1.2+1
  flutter_staggered_grid_view: 0.3.4
  flutter_statusbarcolor: 0.2.3
  flutter_swiper: 1.1.6
  visibility_detector: 0.1.5
  font_awesome_flutter: 8.11.0
  image_picker: 0.6.7+15
  file_picker: 2.1.6
  multi_image_picker: 4.7.15
  intro_slider: 2.3.4
  liquid_swipe: 1.5.0
  page_indicator: 0.3.0
  percent_indicator: 2.1.9+1
  pin_code_fields: 6.1.0
  pull_to_refresh: 1.6.4
  rate_my_app: 0.7.2
  sticky_headers: 0.1.8+1
  zoom_widget: 0.1.3
  cupertino_icons: any

  # WEB TOOLS
  video_player: 2.0.0
  html_unescape: 1.0.2
  webview_flutter: 2.0.1
  flutter_widget_from_html: 0.6.0-rc.2021030401
  flutter_webview_plugin: 0.3.11
  responsive_builder: 0.3.0


  # MAP
  google_maps_flutter: 1.2.0
  location: 2.3.5 # use this version to compatible with fluxbuilder

  # STORAGE
  localstorage: 3.0.6+9 # depend on google font
  shared_preferences: 2.0.3

  # CONNECTIVITY
  connectivity: 2.0.2
  http: 0.13.0
  http_auth: 0.3.1

  uni_links: 0.4.0
  firebase_dynamic_links: 0.6.3


  # AUTHENTICATION
  apple_sign_in: 0.1.0
  flutter_facebook_login: 3.0.0
  google_sign_in: 4.5.6


  # PUSH NOTIFICATION
  firebase_messaging: 7.0.3
  notification_permissions: 0.4.8
  onesignal_flutter: 2.6.2

  # PAYMENTS
  stripe_sdk:
    git:
      url: git://github.com/inspireui/stripe-sdk.git
  razorpay_flutter: 1.2.3

  # IMAGES
  extended_image:
    git:
      url: git://github.com/inspireui/extended_image.git

  transparent_image: 1.0.0

  # ADS
  facebook_audience_network: 0.7.1
  firebase_admob: 0.10.3

  # IN APP
  new_version: ^0.2.0



  # TOOLS
  auto_size_text: 2.1.0
  event_bus: 1.1.1
  google_fonts: 2.0.0
  random_string: 2.1.0
  share: 0.6.5+4
  sms_autofill: 1.3.1
  json_annotation: 3.1.1
  timeago: 3.0.1
  universal_platform: ^0.1.3
  uuid: 3.0.1
  validate: 1.7.0
  vector_math: any
  async: 2.5.0
  easy_debounce: 1.0.2
  jwt_decoder: 1.0.4
  charts_flutter: 0.9.0
  flutter_image_compress: ^0.7.0
  encrypt: 4.1.0
  adaptive_breakpoints: 0.0.3
  intl: 0.17.0

  # For Shopify GraphQL
  graphql: 3.1.0

  flutter_localizations:
    sdk: flutter

dev_dependencies:
  flutter_test:
    sdk: flutter
    version: any
  flutter_launcher_icons: 0.8.1
  mockito: ^4.1.1 # Testing
  #To run json serializer, run:
  # flutter pub run build_runner build --build-filter="lib/models/serializers/*.dart" --delete-conflicting-outputs
  # flutter pub run build_runner serve --build-filter="lib/models/serializers/*.dart"
  build_runner: 1.11.1
  json_serializable: 3.5.1


### Override the library to support Flutter 2.0
### Note: This will show the warning but will not impact to the app features ?
dependency_overrides:
  intl: 0.17.0
  http: 0.13.0
  crypto: 3.0.0
  path_provider: 2.0.1
  uuid: 3.0.1
  http_parser: 4.0.0
  shared_preferences: 2.0.3
  pedantic: 1.9.2
  flutter_svg: 0.19.3
  extended_image:
    git:
      url: git://github.com/inspireui/extended_image.git

  url_launcher: 6.0.1
  cached_network_image: 2.5.0
  fwfh_cached_network_image: ^0.6.0-rc.2021030401
  modal_bottom_sheet: 2.0.0-nullsafety.1



# Run this script to generate the app icon: flutter pub run flutter_launcher_icons:main
flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/app_icon.png"

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

# The following section is specific to Flutter.
flutter:
  uses-material-design: true
  assets:
    - lib/config/
    - lib/config/mocks/
    - lib/config/states/
    - lib/config/stories/
    - assets/icons/categories/
    - assets/icons/tabs/
    - assets/icons/payment/
    - assets/images/
    - assets/images/country/
    - assets/images/favicon/
    - assets/html/
    - assets/google_fonts/
  fonts:
    - family: Feather
      fonts:
        - asset: assets/fonts/Feather.ttf
    - family: SF Pro Display
      fonts:
        - asset: assets/fonts/SF-Pro-Display-Semibold.otf
          weight: 700

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.io/assets-and-images/#resolution-aware.
  # For details regarding adding assets from package dependencies, see
  # https://flutter.io/assets-and-images/#from-packages
  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.io/custom-fonts/#from-packages
flutter_intl:
  enabled: true

2 个答案:

答案 0 :(得分:0)

您可以这样做以强制使用特定版本

dependency_overrides:
  package_info_plus_platform_interface: ^1.0.0

dependency_overrides:
  plugin_platform_interface: ^2.0.0

答案 1 :(得分:0)

只需写下 new_version: any,即可获得 pub。之后,从pubspec.lock 获取合适的版本。你会得到解决方案。

相关问题