Closed diegog-sf closed 1 year ago
Something that its weird is that it worked for a few days and then suddenly it stoped compiling, but I didn't committed my changes so I don't know how it was working
@diegog-sf See if this issue and underlying comments are helpful in your case or not.
Hey @darshankawar that's not exactly my issue, the collection references are generating correctly, the issue in my example is that the invoice.g.dart file is trying to access private vars from the company.g.dart file
When I define company as the parent collection, it generates the collection reference on the invoices file, but companyFieldMap is only present on the company.g.dart file
Thanks for the update. Keeping this issue open for @rrousselGit's input.
Separating the model from the collection reference isn't supported. As you can see, the collection reference is dependent on private values generated next to the model. They wouldn't be accessible if the model/ref are separate.
But we could have a better error message for this. I'll close this in favor of an issue about having a better error message
Closing in favor of https://github.com/firebase/flutterfire/issues/11236
Bug report
I cannot separate my models into multiple files as the generator is trying to access private fields from the parent class collection. specifically _$$[ClassName]FieldMap
Steps to reproduce
Steps to reproduce the behavior:
create a freezed class
on a separate file, create another freezed class and define the odm collections
the generator will generate an update method trying to access the private variable.
The app fails when building with error
The getter '_$$_CompanyFieldMap' isn't defined for the class '_$CompanyDocumentReference'.
Expected behavior
App runs
Sample project
Providing a minimal example project which demonstrates the bug in isolation from your main App greatly enhances the chance of a timely fix. Please link to the public repository URL.
Additional context
Add any other context about the problem here.
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
``` Doctor summary (to see all details, run flutter doctor -v): [β] Flutter (Channel stable, 3.10.1, on macOS 13.1 22C65 darwin-arm64, locale en-MX) [β] Android toolchain - develop for Android devices β Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use `flutter config --android-sdk` to update to that location. [β] Xcode - develop for iOS and macOS (Xcode 14.3.1) [β] Chrome - develop for the web [!] Android Studio (not installed) [β] VS Code (version 1.79.2) [β] Connected device (4 available) [β] Network resources ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 3.0.1 Flutter SDK 3.10.1 robocob 0.1.0 dependencies: - cloud_firestore 4.8.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cloud_firestore_odm 1.0.0-dev.62 [cloud_firestore flutter json_annotation meta] - collection 1.17.1 - dartz 0.10.1 - easy_cron 0.9.2 [equatable] - file_picker 5.3.2 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32] - firebase_auth 4.6.3 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 2.14.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_database 10.2.3 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter] - firebase_storage 11.2.4 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - firebase_ui_auth 1.5.0 [email_validator firebase_auth firebase_core firebase_dynamic_links firebase_ui_localizations firebase_ui_oauth firebase_ui_shared flutter flutter_localizations] - firebase_ui_localizations 1.5.0 [flutter flutter_localizations path] - flutter 0.0.0 [characters collection js material_color_utilities meta vector_math sky_engine] - flutter_bloc 8.1.3 [bloc flutter provider] - flutter_dropzone 3.0.5 [flutter flutter_dropzone_platform_interface flutter_dropzone_web] - flutter_localizations 0.0.0 [flutter intl characters clock collection js material_color_utilities meta path vector_math] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - freezed_annotation 2.2.0 [collection json_annotation meta] - go_router 9.0.0 [collection flutter flutter_web_plugins logging meta] - intl 0.18.0 [clock meta path] - json_annotation 4.8.1 [meta] - meta 1.9.1 - rxdart 0.27.7 - url_launcher 6.1.11 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - xml2json 6.1.0 [xml] dev dependencies: - build_runner 2.4.6 [analyzer args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - cloud_firestore_odm_generator 1.0.0-dev.62 [analyzer build build_config cloud_firestore_odm collection freezed_annotation graphs json_annotation meta recase source_gen] - flutter_lints 2.0.1 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters collection js matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] - freezed 2.3.5 [analyzer build build_config collection meta source_gen freezed_annotation json_annotation] - integration_test 0.0.0 [flutter flutter_driver flutter_test path vm_service async boolean_selector characters clock collection fake_async file js matcher material_color_utilities meta source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api vector_math webdriver] - json_serializable 6.7.0 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper] transitive dependencies: - _fe_analyzer_shared 61.0.0 [meta] - _flutterfire_internals 1.3.3 [collection firebase_core firebase_core_platform_interface flutter meta] - analyzer 5.13.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - args 2.4.2 - async 2.11.0 [collection meta] - bloc 8.1.2 [meta] - boolean_selector 2.1.1 [source_span string_scanner] - build 2.4.0 [analyzer async convert crypto glob logging meta package_config path] - build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 4.0.0 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.2.0 [analyzer async build collection crypto graphs logging path package_config pool pub_semver stream_transform yaml] - build_runner_core 7.2.10 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta package_config path pool timing watcher yaml] - built_collection 5.1.1 - built_value 8.6.1 [built_collection collection fixnum meta] - characters 1.3.0 - checked_yaml 2.0.3 [json_annotation source_span yaml] - clock 1.1.1 - cloud_firestore_platform_interface 5.15.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.6.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - code_builder 4.5.0 [built_collection built_value collection matcher meta] - convert 3.1.1 [typed_data] - crypto 3.0.3 [typed_data] - dart_style 2.3.1 [analyzer args path pub_semver source_span] - desktop_webview_auth 0.0.12 [crypto flutter http flutter_web_plugins plugin_platform_interface] - email_validator 2.1.17 - equatable 2.0.5 [collection meta] - fake_async 1.3.1 [clock collection] - ffi 2.0.2 - file 6.1.4 [meta path] - firebase_auth_platform_interface 6.15.3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.5.3 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta] - firebase_core_platform_interface 4.8.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.6.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_database_platform_interface 0.2.5+3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_database_web 0.2.3+3 [firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins js] - firebase_dynamic_links 5.3.3 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface] - firebase_dynamic_links_platform_interface 0.2.6+3 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_storage_platform_interface 4.4.3 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.6.4 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - firebase_ui_oauth 1.4.4 [desktop_webview_auth firebase_auth firebase_ui_auth firebase_ui_shared flutter_svg flutter] - firebase_ui_shared 1.3.0 [flutter] - fixnum 1.1.0 - flutter_driver 0.0.0 [file flutter flutter_test fuchsia_remote_debug_protocol path meta vm_service webdriver async boolean_selector characters clock collection js matcher material_color_utilities platform process source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api vector_math] - flutter_dropzone_platform_interface 2.0.5 [flutter plugin_platform_interface] - flutter_dropzone_web 3.0.8 [flutter flutter_web_plugins flutter_dropzone_platform_interface js] - flutter_plugin_android_lifecycle 2.0.15 [flutter] - flutter_svg 2.0.7 [flutter vector_graphics vector_graphics_codec vector_graphics_compiler] - frontend_server_client 3.2.0 [async path] - fuchsia_remote_debug_protocol 0.0.0 [process vm_service file meta path platform] - glob 2.1.2 [async collection file path string_scanner] - graphs 2.2.0 [collection] - http 0.13.6 [async http_parser meta] - http_multi_server 3.2.1 [async] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - io 1.0.4 [meta path string_scanner] - js 0.6.7 [meta] - lints 2.1.1 - logging 1.2.0 - matcher 0.12.15 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.2.0 - mime 1.0.4 - nested 1.0.0 [flutter] - package_config 2.1.0 [path] - path 1.8.3 - path_parsing 1.0.1 [vector_math meta] - petitparser 5.4.0 [meta] - platform 3.1.0 - plugin_platform_interface 2.1.4 [meta] - pool 1.5.1 [async stack_trace] - process 4.2.4 [file path platform] - provider 6.0.5 [collection flutter nested] - pub_semver 2.1.4 [collection meta] - pubspec_parse 1.2.3 [checked_yaml collection json_annotation pub_semver yaml] - recase 4.1.0 - shelf 1.4.1 [async collection http_parser path stack_trace stream_channel] - shelf_web_socket 1.0.4 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_gen 1.3.2 [analyzer async build dart_style glob path source_span yaml] - source_helper 1.3.3 [analyzer collection source_gen] - source_span 1.9.1 [collection path term_glyph] - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - stream_transform 2.1.0 - string_scanner 1.2.0 [source_span] - sync_http 0.3.1 - term_glyph 1.2.1 - test_api 0.5.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - timing 1.0.1 [json_annotation] - typed_data 1.3.2 [collection] - url_launcher_android 6.0.36 [flutter url_launcher_platform_interface] - url_launcher_ios 6.1.4 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.5 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.5 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.3 [flutter plugin_platform_interface] - url_launcher_web 2.0.17 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.6 [flutter url_launcher_platform_interface] - vector_graphics 1.1.7 [flutter vector_graphics_codec] - vector_graphics_codec 1.1.7 - vector_graphics_compiler 1.1.7 [args meta path_parsing xml vector_graphics_codec] - vector_math 2.1.4 - vm_service 11.3.0 - watcher 1.1.0 [async path] - web_socket_channel 2.4.0 [async crypto stream_channel] - webdriver 3.0.2 [matcher path stack_trace sync_http] - win32 5.0.4 [ffi] - xml 6.3.0 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```