mzimmerm / flutter_charts

Charts Library for Flutter, written in Dart with Flutter.
Other
250 stars 42 forks source link

Please upgrade dependencies to be compatible with google_fonts v6.1.0+ #43

Open RoarGronmo opened 9 months ago

RoarGronmo commented 9 months ago

Similar to https://github.com/mzimmerm/flutter_charts/issues/37 which i rose earlier, we are now having problem with upgrading to google_fonts v6.1.0:

If we ar setting the google_fonts dependency to v.6.1.0 we get this error:

C:\Flutter\flutter\bin\flutter.bat --no-color pub get
Resolving dependencies...
Because no versions of flutter_charts match >0.5.1 <0.6.0 and flutter_charts >=0.5.0 <0.5.1 depends on google_fonts ^2.2.0, flutter_charts >=0.5.0 <0.5.1-∞ or >0.5.1 <0.6.0 requires google_fonts ^2.2.0.
And because flutter_charts 0.5.1 depends on google_fonts ^4.0.3, flutter_charts ^0.5.0 requires google_fonts ^2.2.0 or ^4.0.3.
So, because m_office depends on both google_fonts ^6.1.0 and flutter_charts ^0.5.0, version solving failed.

You can try one of the following suggestions to make the pubspec resolve:
* Consider downgrading your constraint on flutter_charts: flutter pub add flutter_charts:^0.4.0
* Consider downgrading your constraint on google_fonts: flutter pub add google_fonts:^4.0.5
Process finished with exit code 1

So again we are stuck with a lower version of google_fonts which this library is using.

Reverting to google_fonts ^4.0.5 it works again, but that isn't desirable for us.

mzimmerm commented 9 months ago

Hi Roar,

do you mind attaching the pubspec.yaml of the app (cleaned of any sensitive info if applicable) as well as 'flutter doctor' results?

I need to look again how the dependencies work, I thought using 'google_fonts: ^4.0.3' would allow any version later than that, but obviously not.

So I am thinking the issue may be either with flutter_charts specifying sdk: '>=2.17.0 <3.0.0'. Either flutter_charts dependencies restrict google fonts is a way I do not understand, or there is something in m_office dependencies that clashes with flutter_charts: 0.5.1 pubspec.

Anyway, seeing your pubspec would help me

Thanks for reporting this, Milan

RoarGronmo commented 9 months ago

Here's our pubspec.yaml for the moment

name: m_office
description: An office app collection for Norva24.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# 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 is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.2.3+40

environment:
  #sdk: '>=2.19.0-444.6.beta <4.0.0'
  sdk: '>=3.0.0 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
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: ^1.0.2

  #---Google maps
  google_maps_flutter: ^2.1.12
  google_maps_flutter_web: ^0.5.0+1
  google_maps_cluster_manager: ^3.0.0+1
  flutter_google_street_view: ^3.0.0
  pointer_interceptor: ^0.9.3+2
  maps_toolkit: ^3.0.0

  #---Google fonts
  google_fonts: ^4.0.3
  #google_fonts: ^6.1.0

  #---Charts
  #charts_flutter: ^0.12.0 #old
  flutter_charts: ^0.5.0

  #---Cached network image
  cached_network_image: ^3.2.3

  #---Dropdown menu
  dropdown_button2: ^2.0.0

  #---Logging
  logging: ^1.0.2

  #---Visibility detector
  visibility_detector: ^0.4.0+2

  #---Preferences
  #pref: ^2.7.1

  #---Shared preferences
  shared_preferences: ^2.1.0

  #---Aad Oauth
  aad_oauth: ^1.0.0

  #---Jwt
  jwt_decode: ^0.3.1

  #---Bidirectional listview
  bidirectional_listview: ^1.0.3
  infinite_listview: ^1.1.0

  #---Scrollable listview
  scrollable_positioned_list: ^0.3.2

  #---Linked scroll controller
  linked_scroll_controller: ^0.2.0

  #---Swagger
  chopper: ^7.0.8
  json_annotation: ^4.6.0

  #---Drift
  drift: ^2.5.0
  sqlite3_flutter_libs: ^0.5.9
  path_provider: ^2.0.11
  path: ^1.8.2
  drift_db_viewer: ^2.0.0

  #---Formatter
  intl: ^0.18.1
  #intl: ^0.17.0

  #---Http
  http: ^1.1.0
  #http: ^1.0.0

  #---Package info plus
  #package_info_plus: ^5.0.0
  package_info_plus: ^4.1.0

  #---Firebase
  #firebase_core: ^2.3.0
  #firebase_performance: ^0.9.0+12

  #---Google fonts
  #google_fonts: ^2.2.0

  #---Collection
  collection: ^1.16.0

  #---Universal io
  universal_io: ^2.0.5

  #---PDF
  pdf: ^3.10.4

  #---printing:
  printing: ^5.11.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.0

  #---Swagger
  build_runner: ^2.2.0
  chopper_generator: ^7.0.5+1
  json_serializable: ^6.3.1
  swagger_dart_code_generator: ^2.11.8

  #---Drift
  drift_dev: ^2.5.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 packages.
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:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/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:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

We have rosen the Flutter version to use at least 3.13.x, but preferebly the beta release which is now at 3.16.x

Note! The pubspec.yaml above contains google_fonts ^4.0.3 which seems to be comatible with flutter_charts ^0.5.0. But the problem is that we cannot rise to google_fonts ^6.1.0.

Your library works great (!) but we see that it lacks behind because of the mentioned difficulties where the needed google_fonts ^6.1.0 when running flutter pub outdated at the moment:

PS C:\FlutterProjects\mOffice> flutter pub outdated
Showing outdated packages.
[*] indicates versions that are not the latest available.

Package Name  Current  Upgradable  Resolvable  Latest

direct dependencies:
google_fonts  *4.0.5   *4.0.5      *4.0.5      6.1.0

dev_dependencies: all up-to-date.
You are already using the newest resolvable versions listed in the 'Resolvable' column.
Newer versions, listed in 'Latest', may not be mutually compatible.

As we have seen, major version updates are not done until you rise the major level of the library you are using. Therefore we run "flutter pub upgrade --major-versions", which will try to upgrade the major versions which they see are safe to do so. We just did that with our app when another library recently was updated to use http ^1.1.0 which had lacked behind for months. In terms theese situations are often called "Dependency hog", which may be a concern with Flutter in general.

After the "major-versions" upgrade, we where left behind with google_fonts above, pinpointing that library to 6.1.0 it pointed to your library as shown in the main issue above:

C:\Flutter\flutter\bin\flutter.bat --no-color pub get
Resolving dependencies...
Because no versions of flutter_charts match >0.5.1 <0.6.0 and flutter_charts >=0.5.0 <0.5.1 depends on google_fonts ^2.2.0, flutter_charts >=0.5.0 <0.5.1-∞ or >0.5.1 <0.6.0 requires google_fonts ^2.2.0.
And because flutter_charts 0.5.1 depends on google_fonts ^4.0.3, flutter_charts ^0.5.0 requires google_fonts ^2.2.0 or ^4.0.3.
So, because m_office depends on both google_fonts ^6.1.0 and flutter_charts ^0.5.0, version solving failed.

You can try one of the following suggestions to make the pubspec resolve:
* Consider downgrading your constraint on flutter_charts: flutter pub add flutter_charts:^0.4.0
* Consider downgrading your constraint on google_fonts: flutter pub add google_fonts:^4.0.5
Process finished with exit code 1

Flutter doctor shows:

PS C:\FlutterProjects\mOffice> flutter doctor -v
[√] Flutter (Channel beta, 3.16.0-0.1.pre, on Microsoft Windows [Version 10.0.22621.2428], locale nb-NO)
    • Flutter version 3.16.0-0.1.pre on channel beta at c:\Flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f0abad66b2 (28 hours ago), 2023-10-10 19:29:41 -0700
    • Engine revision 7ccdde78a7
    • Dart version 3.2.0 (build 3.2.0-210.1.beta)
    • DevTools version 2.28.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\roarg\AppData\Local\Android\Sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = C:\Users\roarg\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android Studio\Android Studio 2023.2.1.6\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.8+0--10799086)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2019 16.11.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31702.278
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2022.3)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2022.3.1.20
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)

[√] Android Studio (version 2022.3)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2022.3.1.16
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)

[√] Android Studio (version 2023.1)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2023.1.1.22
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)

[√] Android Studio (version 2023.2)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2023.2.1.6
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.8+0--10799086)

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.2428]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 118.0.5993.70
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 117.0.2045.60
mzimmerm commented 9 months ago

Thanks for sharing your pubspec, Flutter doctor, as well as extended comments.

I only went over everything quickly, but it is becoming clear the constraint in flutter_charts

'google_fonts: ^4.0.3'

is the reason for the ceiling, as that allows all versions, up to (not including) 5.0.0 - that is how the ^ versioning is designed.

I am contemplating to change it to something like

'google_fonts: >=4.0.0'

One potential problem with this is, that Google_fonts, in version 5.0.0 or higher, can change the API, as allowed by semantic versioning. So they could potentially remove some API method flutter_charts are using - although I very much doubt such removal, it is a bit of a future trap potentially.

So I will test with the contemplated google_fonts constraint change (and I will also up the restriction on flutter sdk and dart sdk) and if it looks good, release it as flutter_charts 0.5.2.

I will let you know,

Milan

PS: Not much relevant: I am still deep into a complete refactoring of flutter_charts (on branch flutter_charts_v4_2023-01-26_convert_Presenters_to_BoxContainers) but that will be ready further in the future than I assumed, as I am moving the whole thing deeper into abstractions than originally intended, basically writing a new auto layout engine for flutter_charts, for it to become a basis for a simple desktop layout framework. Anyway, not relevant short term.

mzimmerm commented 8 months ago

Hi Roar,

I have published flutter_charts version 0.5.2 with dependency updates as follows:

sdk: '>=2.15.0 <3.0.0' to sdk: '>=2.15.0 <4.0.0' google_fonts: ^4.0.3 to google_fonts: logger: ^1.1.0 to logger:

This means flutter_charts promises to support any future versions of google_fonts and logger :) but it should address your need for the latest google_fonts now and in the future.

Please let me know if this helps you and if it does, go ahead and close this.

Thanks for using flutter_charts.

Milan

PS: Just a note, if you have any future problems with a dependency package that you use which does not update it's own dependencies (thus blocking you from using the latest), you could add something like this to your pubspec.yaml - just make you test your application ensuring your override did not break the other package -

dependency_overrides: google_fonts: ">=6.0.0"

[You do NOT have to do this for google_fonts due to flutter_charts now :) ]