rydmike / flex_color_scheme

A Flutter package to make and use beautiful color scheme based themes.
Other
947 stars 105 forks source link

Error: Type argument 'double' doesn't conform to the bound 'Enum?' of the type variable 'T' on 'EnumProperty'. #217

Closed chandlery54 closed 7 months ago

chandlery54 commented 8 months ago

When I try to build my app on an iPhone 15 Pro Simulator running iOS 17.0 I get the following error:

Error (Xcode): ../../.pub-cache/hosted/pub.dev/flex_color_scheme-6.1.2/lib/src/flex_sub_themes_data.dart:3024:20: Error: Type argument 'double' doesn't conform to the bound 'Enum?' of the type variable 'T' on 'EnumProperty'.

Could not build the application for the simulator.
Error launching application on iPhone 15 Pro.

I am not sure exactly what this means, but it clearly seems to be coming from flex_sub_themes_data in this package.

I am running Flutter version 3.16.4 and Dart 3.2.3 as seen below.

Framework • revision 2e9cb0aa71 (5 weeks ago) • 2023-12-11 14:35:13 -0700
Engine • revision 54a7145303
Tools • Dart 3.2.3 • DevTools 2.28.4

Here is a breakdown of my flutter doctor:

[✓] Flutter (Channel stable, 3.16.4, on macOS 14.1.1 23B81 darwin-arm64 (Rosetta), locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.82.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Has anybody else run into this? Is it a simple fix?

Any help would be greatly appreciated. Thanks!

chandlery54 commented 8 months ago

It looks like it must be something to do with Flutter 3.16.+ cause I switched back to Flutter 3.13.3 (which I happened to have from another old project) and it ran fine without the error.

Framework • revision 2524052335 (4 months ago) • 2023-09-06 14:32:31 -0700
Engine • revision b8d35810e9
Tools • Dart 3.1.1 • DevTools 2.25.0
rydmike commented 8 months ago

Hi @chandlery54, thanks for filing the issue.

I have not seen or heard of this issue before.

The Xcode error seem to point to that you from the cached version are using FlexColorScheme (FCS) 6.1.2.

Due to breaking changes in Flutter framework SDK since the release of FCS 6.1.2, this version is not fully backwards compatible with Flutter 3.16.x. You need to use at least FCS version 7.3.x to get a version that is compatible with Flutter 3.16.x. I recommend to begin with assuring that the build is actually using the FlexColorScheme version 7.3.1.

Also after upgrading to FCS 7.3.1 in pubspec, just to make sure, do:

flutter clean
flutter pub get
flutter pub upgrade

So that no older version remains in the build cache. The above should not be needed, normally flutter pub get is enough, but it has be known to happen that projects sometimes need it. Not related to FCS, but I have just seen it generally in some cases.

Yukinosuke-Takada commented 7 months ago

Also after upgrading to FCS 7.3.1 in pubspec, just to make sure, do:

@rydmike Had the same issue after upgrading Flutter. Can confirm, upgrading to 7.3.1 (was using 7.2.0 before) resolves this problem

chandlery54 commented 7 months ago

Yes, thank you for the suggestions. It must have been cached on an old version like you said, because I thought I had already updated to the latest. But after cleaning and updating again it was resolved.

Thanks for your help.