aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.32k stars 248 forks source link

'AuthProvider' doesn't conform to the bound 'Enum?' when setting up the Authenticator #4548

Closed JannicMeetYu closed 7 months ago

JannicMeetYu commented 7 months ago

Description

We are setting up our authentication flow, exactly how it's done in the documentation, but everytime we want to run the application, this error occurs: On MacOs for iOs: Error (Xcode): ../../../../.pub-cache/hosted/pub.dev/amplify_authenticator-1.2.0/lib/src/widgets/social/social_button.dart:128:13: Error: Type argument 'AuthProvider' doesn't conform to the bound 'Enum?' of the type variable 'T' on 'EnumProperty'.

And on Windows for Android: /C:/Users/Admin/AppData/Local/Pub/Cache/hosted/[pub.dev/amplify_authenticator-1.2.0/lib/src/widgets/social/social_button.dart:128:13](http://pub.dev/amplify_authenticator-1.2.0/lib/src/widgets/social/social_button.dart:128:13): Error: Type argument 'AuthProvider' doesn't conform to the bound 'Enum?' of the type variable 'T' on 'EnumProperty'.

We tried usual procedure flutter upgrade, amplify upgrade, but hasn't solved the error. Manually changing the versions of the authenticator didn't help as well. What could be cause of this? What could be potential solutions?

Categories

Steps to Reproduce

We just followed the guide from the Authenticator for Flutter. Did the steps like pulling backend, installing dependencies and adding the authenticator in our main.dart. When running the app, the error occurs and the build is stopped.

Screenshots

No response

Platforms

Flutter Version

3.19.3

Amplify Flutter Version

1.0.1

Deployment Method

Amplify CLI

Schema

No response

Equartey commented 7 months ago

Hi @JannicMeetYu, it looks like your Amplify Flutter version is old, have you tried updating your amplify packages to their latest versions?

Can you post your pubspec.yaml?

JannicMeetYu commented 7 months ago

Yeah sure. dependencies: flutter: sdk: flutter

flutter_localizations: sdk: flutter

amplify_auth_cognito: ^1.0.1 amplify_flutter: ^1.0.1 amplify_authenticator: ^1.0.1 amplify_datastore: ^1.0.0 amplify_auth_cognito_ios: ^1.0.1

We basically just did flutter clean + flutter pub get, flutter upgrade and amplify upgrade. And it always resulted to these version. We tried manually updating amplify_authenticator but got incompatible versions with the other amplify dependencies.

Jordan-Nelson commented 7 months ago

flutter clean + flutter pub get

If you have a pubspec.lock file this will install the version listed in the lock file. You can run flutter pub upgrade to upgrade to the latest version allowed by the constraint in your pubpsec.yaml file. See the Flutter docs for more info on installing/upgrading packages from the CLI. Once you have upgraded you can look at your lock file, or run flutter pub deps --no-dev --style=compact to verify the packages were upgraded.

If you are still facing issues after upgrading please share the output of flutter pub deps --no-dev --style=compact.

JannicMeetYu commented 7 months ago

Sorry for the delayed reply. This did not fix the issue, we even setup a new app in amplify but this also did not solve the issue. Here is the output of the command: Dart SDK 3.3.1 Flutter SDK 3.19.3 meetyu 1.0.4+4

dependencies:

transitive dependencies:

JannicMeetYu commented 7 months ago

I solved the issue. amplify_auth_cognito_ios is/was the problem. It prevented the other packages from upgrading. Removing it, solved the issue.

Equartey commented 7 months ago

@JannicMeetYu glad you could resolve it. Do you know what package & version it was colliding with?