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.33k stars 247 forks source link

Modelprovider class error #1422

Closed zamargab closed 2 years ago

zamargab commented 2 years ago

Description

I have been using Amplify plugins of versions 0.2.2, I just upgraded to versions 0.4.1 and I am facing an issue, My Modelprovider class that was auto generated by Amplify shows an error and when I try to inspect the error, I get the error message below

Missing concrete implementations of 'getter ModelProviderInterface.customTypeSchemas' and 'setter ModelProviderInterface.customTypeSchemas'. Try implementing the missing methods, or make the class abstract.

Categories

Steps to Reproduce

  1. Upgrade all Amplify packages from version 0.2.2 to 0.4.1
  2. Run flutter clean
  3. Build app

Screenshots

Screenshot 2022-03-02 at 01 58 46

Platforms

Environment

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.3, on Mac OS X 10.15.7 19H1615 darwin-x64,
    locale en-NG)
[!] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.64.2)
[✓] Connected device (2 available)

Dependencies

Dart SDK 2.14.4
Flutter SDK 2.5.3
nuscription 1.0.0+1

dependencies:
- amplify_api 0.4.1 [amplify_api_plugin_interface amplify_core collection flutter meta plugin_platform_interface]
- amplify_auth_cognito 0.4.1 [flutter amplify_auth_plugin_interface amplify_core collection plugin_platform_interface]
- amplify_datastore 0.4.1 [flutter amplify_datastore_plugin_interface amplify_core plugin_platform_interface meta collection async]
- amplify_flutter 0.4.1 [amplify_analytics_plugin_interface amplify_api_plugin_interface amplify_auth_plugin_interface amplify_core amplify_datastore_plugin_interface amplify_storage_plugin_interface collection flutter json_annotation meta plugin_platform_interface]
- amplify_storage_s3 0.4.1 [flutter amplify_storage_plugin_interface plugin_platform_interface amplify_core]
- awesome_dialog 2.1.1 [flutter simple_animations flare_flutter]
- cached_network_image 3.2.0 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- charts_flutter 0.12.0 [charts_common collection flutter intl logging meta]
- chewie 1.2.2 [cupertino_icons flutter provider video_player wakelock]
- cloud_functions 3.2.5 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter]
- country_code_picker 2.0.2 [flutter modal_bottom_sheet collection universal_platform]
- cupertino_icons 1.0.4
- emoji_picker_flutter 1.0.8 [flutter shared_preferences]
- firebase_auth 3.3.5 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 1.11.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_messaging 10.0.9 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- fl_chart 0.40.6 [flutter equatable]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_blue 0.8.0 [flutter convert protobuf rxdart collection meta]
- flutter_chat_bubble 2.0.0 [flutter]
- flutter_launcher_icons 0.9.2 [args image path yaml]
- flutter_login 2.2.1 [flutter font_awesome_flutter provider another_transformer_page_view another_flushbar quiver pedantic]
- flutter_spinkit 5.1.0 [flutter]
- flutter_svg 0.22.0 [flutter meta path_drawing vector_math xml]
- fluttertoast 8.0.8 [flutter flutter_web_plugins]
- http 0.13.4 [async http_parser meta path]
- image 3.1.0 [archive meta xml]
- image_picker 0.7.5+4 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface image_picker_for_web]
- intl 0.17.0 [clock path]
- is_first_run 1.0.0 [flutter shared_preferences]
- path_provider 2.0.8 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- pin_code_fields 7.3.0 [flutter]
- shared_preferences 2.0.9 [flutter meta shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- shimmer 2.0.0 [flutter]
- sizer 2.0.15 [universal_io flutter]
- sleek_circular_slider 2.0.1 [flutter]
- table_calendar 3.0.3 [flutter intl simple_gesture_detector]
- twilio_voice 0.0.9 [flutter]
- uuid 3.0.5 [crypto]
- video_player 2.2.7 [flutter meta video_player_platform_interface video_player_web html]
- webview_flutter 3.0.0 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview]
- xfile 1.1.0

transitive dependencies:
- amplify_analytics_plugin_interface 0.4.1 [amplify_core flutter meta]
- amplify_api_plugin_interface 0.4.1 [amplify_core collection flutter json_annotation meta]
- amplify_auth_plugin_interface 0.4.1 [flutter meta amplify_core]
- amplify_core 0.4.1 [flutter plugin_platform_interface collection date_time_format meta uuid]
- amplify_datastore_plugin_interface 0.4.1 [flutter meta collection amplify_core]
- amplify_storage_plugin_interface 0.4.1 [flutter meta amplify_core]
- another_flushbar 1.10.26 [pedantic flutter]
- another_transformer_page_view 1.0.1 [pedantic flutter]
- archive 3.1.6 [crypto path]
- args 2.3.0
- async 2.8.1 [collection meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager]
- cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface]
- characters 1.1.0
- charcode 1.3.1
- charts_common 0.12.0 [collection intl logging meta vector_math]
- clock 1.1.0
- cloud_functions_platform_interface 5.0.20 [firebase_core flutter meta plugin_platform_interface]
- cloud_functions_web 4.2.6 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- collection 1.15.0
- convert 3.0.1 [typed_data]
- cross_file 0.3.2 [flutter js meta]
- crypto 3.0.1 [collection typed_data]
- csslib 0.17.1 [source_span]
- date_time_format 2.0.1
- equatable 2.0.3 [collection meta]
- fake_async 1.2.0 [clock collection]
- ffi 1.1.2
- file 6.1.2 [meta path]
- firebase_auth_platform_interface 6.1.10 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 3.3.6 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core_platform_interface 4.2.3 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.5.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging_platform_interface 3.1.6 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.2.6 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- fixnum 1.0.0
- flare_flutter 3.0.2 [collection flutter meta]
- flutter_blurhash 0.6.0 [flutter meta pedantic]
- flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_lints 1.0.4 [lints]
- flutter_plugin_android_lifecycle 2.0.5 [flutter]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- font_awesome_flutter 9.2.0 [flutter]
- html 0.15.0 [csslib source_span]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image_picker_for_web 2.1.4 [flutter flutter_web_plugins image_picker_platform_interface meta]
- image_picker_platform_interface 2.4.1 [flutter http meta plugin_platform_interface cross_file]
- js 0.6.3
- json_annotation 4.4.0 [meta]
- lints 1.0.1
- logging 1.0.2
- matcher 0.12.10 [stack_trace]
- meta 1.7.0
- modal_bottom_sheet 2.0.0 [flutter]
- nested 1.0.0 [flutter]
- octo_image 1.0.1 [flutter flutter_blurhash]
- path 1.8.0
- path_drawing 0.5.1+1 [vector_math meta path_parsing flutter]
- path_parsing 0.2.1 [vector_math meta]
- path_provider_android 2.0.9 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.7 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.2 [flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.4 [flutter meta path_provider_platform_interface]
- path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface]
- path_provider_windows 2.0.4 [ffi flutter meta path path_provider_platform_interface win32]
- pedantic 1.11.1
- petitparser 4.4.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.0.2 [meta]
- process 4.2.4 [file path platform]
- protobuf 2.0.1 [fixnum collection]
- provider 5.0.0 [collection flutter nested]
- quiver 3.0.1+1 [matcher]
- rxdart 0.26.0
- shared_preferences_android 2.0.9 [flutter meta shared_preferences_platform_interface]
- shared_preferences_ios 2.0.8 [flutter meta shared_preferences_platform_interface]
- shared_preferences_linux 2.0.3 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 2.0.2 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.2 [flutter flutter_web_plugins meta shared_preferences_platform_interface]
- shared_preferences_windows 2.0.3 [file flutter meta path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- simple_animations 3.2.0 [flutter supercharged flutter_lints]
- simple_gesture_detector 0.2.0 [flutter]
- sky_engine 0.0.99
- source_span 1.8.1 [collection path term_glyph]
- sqflite 2.0.1 [flutter sqflite_common path]
- sqflite_common 2.0.1+1 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- string_scanner 1.1.0 [charcode source_span]
- supercharged 2.1.1 [supercharged_dart flutter]
- supercharged_dart 2.1.1
- synchronized 3.0.0
- term_glyph 1.2.0
- test_api 0.4.2 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0 [collection]
- universal_io 2.0.4 [collection crypto meta typed_data]
- universal_platform 1.0.0+1
- vector_math 2.1.0
- video_player_platform_interface 4.2.0 [flutter flutter_test meta]
- video_player_web 2.0.4 [flutter flutter_web_plugins meta video_player_platform_interface]
- wakelock 0.5.6 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows]
- wakelock_macos 0.4.0 [flutter flutter_web_plugins wakelock_platform_interface]
- wakelock_platform_interface 0.3.0 [flutter meta]
- wakelock_web 0.4.0 [flutter flutter_web_plugins js wakelock_platform_interface]
- wakelock_windows 0.2.0 [flutter wakelock_platform_interface win32]
- webview_flutter_android 2.8.2 [flutter webview_flutter_platform_interface]
- webview_flutter_platform_interface 1.8.0 [flutter plugin_platform_interface]
- webview_flutter_wkwebview 2.7.1 [flutter webview_flutter_platform_interface]
- win32 2.3.1 [ffi]
- xdg_directories 0.2.0 [meta path process]
- xml 5.3.1 [collection meta petitparser]
- yaml 3.1.0 [collection source_span string_scanner]

Device

Iphone 12 mini

OS

IOS 14.4

CLI Version

7.6.2

Additional Context

No response

dnys1 commented 2 years ago

Hi @zamargab - can you try regenerating your models by running amplify codegen models?

Note: you'll need to have CLI version >=7.6.10. You can run npm install -g @aws-amplify/cli to get the latest.

zamargab commented 2 years ago

Even after update CLI, my problem was not solved. I solved it by adding line below to ModelProvider class

List customTypeSchemas = [];

is this a good fix?

HuiSF commented 2 years ago

The manual fix works but it should not be required. Tips:

zamargab commented 2 years ago

Ok.. thanks

AmerBiro commented 2 years ago

@dnys1 you are a life saver. Only your method solved my problem amplify codegen models Thank you a lot

helpmeplease77 commented 1 year ago

@dnys1 you are really good. very thank you.