Closed ghost closed 9 months ago
This also reproduces using the plugin example app if you skip the email verification and go directly to the profile page. This only happens with accounts that have not verified their emails.
https://github.com/firebase/flutterfire/assets/88313112/613fc980-76f0-4e31-8540-fc99248d355c
As of firebase_ui_auth v1.9.1, this is no longer reproducible.
Bug report
Describe the bug
When using the Firebase_Auth_UI package in a Bloc-based state management context, a specific issue arises upon new user registration. The ProfileScreen() function throws an exception related to widget tree state updates.
The problem surfaces specifically when employing the "refreshListenable" feature to rebuild routes based on state changes. Bloc listens effectively to changes in the authentication state (via the AuthBloc stream) and triggers the appropriate route redirections. However, it encounters an error when attempting to redirect a newly registered user to the ProfileScreen().
The thrown exceptions are as follows:
The redirection logic works as expected for authenticated users, unauthenticated users, and during error states. However, it fails during the registration of new users, resulting in the above exceptions.
This bug disrupts the user flow by preventing new users from being correctly redirected to their profile screen after registration. Consequently, the widget tree's locked state appears to interfere with the necessary building of the EditableUserDisplayName widget within the ProfileScreen().
Steps to reproduce
Steps to reproduce the behavior:
A minimal, complete, and verifiable example that demonstrates this issue has been created and can be accessed at zapp.run following this link:
zapp.run project
Expected behavior
It loads the page correctly.
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.
zapp.run project
Additional context
Any other screen works as expected. As an example, I've made a generic WorkingProfileScreen() widget that has a sign-out button. The setup doesn't throw when navigating to it.
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.6, on Microsoft Windows [Version 10.0.22621.2070], locale en-US) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.6.5) [√] Android Studio (version 2022.3) [√] VS Code (version 1.80.2) [√] Connected device (3 available) [√] Network resources • No issues found! ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 3.0.6 Flutter SDK 3.10.6 project 0.1.0 dependencies: - bloc 8.1.2 [meta] - bloc_test 9.1.3 [bloc diff_match_patch meta mocktail test] - equatable 2.0.5 [collection meta] - firebase_auth 4.7.2 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 2.15.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_ui_auth 1.6.2 [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] - firebase_ui_oauth_apple 1.2.7 [firebase_auth firebase_ui_oauth flutter] - firebase_ui_oauth_facebook 1.2.1 [firebase_auth firebase_ui_oauth flutter flutter_facebook_auth] - firebase_ui_oauth_google 1.2.7 [firebase_auth firebase_ui_oauth flutter google_sign_in] - flutter 0.0.0 [characters collection js material_color_utilities meta vector_math sky_engine] - flutter_bloc 8.1.3 [bloc flutter provider] - go_router 10.0.0 [collection flutter flutter_web_plugins logging meta] - hydrated_bloc 9.1.2 [bloc hive meta synchronized] dev dependencies: - flutter_lints 2.0.2 [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] transitive dependencies: - _fe_analyzer_shared 61.0.0 [meta] - _flutterfire_internals 1.3.4 [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] - boolean_selector 2.1.1 [source_span string_scanner] - characters 1.3.0 - clock 1.1.1 - collection 1.17.1 - convert 3.1.1 [typed_data] - coverage 1.6.3 [args logging package_config path source_maps stack_trace vm_service] - crypto 3.0.3 [typed_data] - desktop_webview_auth 0.0.13 [crypto flutter http flutter_web_plugins plugin_platform_interface] - diff_match_patch 0.4.1 - email_validator 2.1.17 - fake_async 1.3.1 [clock collection] - file 7.0.0 [meta path] - firebase_auth_platform_interface 6.16.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.6.2 [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_dynamic_links 5.3.4 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface] - firebase_dynamic_links_platform_interface 0.2.6+4 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_ui_oauth 1.4.7 [desktop_webview_auth firebase_auth firebase_ui_auth firebase_ui_shared flutter_svg flutter] - firebase_ui_shared 1.3.0 [flutter] - flutter_facebook_auth 4.4.1+1 [flutter flutter_facebook_auth_platform_interface flutter_facebook_auth_web] - flutter_facebook_auth_platform_interface 3.2.0 [flutter plugin_platform_interface] - flutter_facebook_auth_web 3.2.0 [flutter flutter_web_plugins js flutter_facebook_auth_platform_interface] - flutter_localizations 0.0.0 [flutter intl characters clock collection js material_color_utilities meta path vector_math] - flutter_svg 2.0.7 [flutter vector_graphics vector_graphics_codec vector_graphics_compiler] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - frontend_server_client 3.2.0 [async path] - glob 2.1.2 [async collection file path string_scanner] - google_identity_services_web 0.2.1 [js meta] - google_sign_in 6.1.4 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web] - google_sign_in_android 6.1.18 [flutter google_sign_in_platform_interface] - google_sign_in_ios 5.6.2 [flutter google_sign_in_platform_interface] - google_sign_in_platform_interface 2.4.1 [flutter plugin_platform_interface quiver] - google_sign_in_web 0.12.0+2 [flutter flutter_web_plugins google_identity_services_web google_sign_in_platform_interface http js] - hive 2.2.3 [meta crypto] - http 1.1.0 [async http_parser meta] - http_multi_server 3.2.1 [async] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - intl 0.18.0 [clock meta path] - 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 - meta 1.9.1 - mime 1.0.4 - mocktail 0.3.0 [collection matcher test] - nested 1.0.0 [flutter] - node_preamble 2.0.2 - package_config 2.1.0 [path] - path 1.8.3 - path_parsing 1.0.1 [vector_math meta] - petitparser 5.4.0 [meta] - plugin_platform_interface 2.1.5 [meta] - pool 1.5.1 [async stack_trace] - provider 6.0.5 [collection flutter nested] - pub_semver 2.1.4 [collection meta] - quiver 3.2.1 [matcher] - shelf 1.4.1 [async collection http_parser path stack_trace stream_channel] - shelf_packages_handler 3.0.2 [path shelf shelf_static] - shelf_static 1.1.2 [convert http_parser mime path shelf] - shelf_web_socket 1.0.4 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_map_stack_trace 2.1.1 [path source_maps stack_trace] - source_maps 0.10.12 [source_span] - source_span 1.9.1 [collection path term_glyph] - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - string_scanner 1.2.0 [source_span] - synchronized 3.1.0 - term_glyph 1.2.1 - test 1.24.1 [analyzer async boolean_selector collection coverage http_multi_server io js node_preamble package_config path pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel typed_data web_socket_channel webkit_inspection_protocol yaml test_api test_core matcher] - test_api 0.5.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - test_core 0.5.1 [analyzer async args boolean_selector collection coverage frontend_server_client glob io meta package_config path pool source_map_stack_trace source_maps source_span stack_trace stream_channel vm_service yaml matcher test_api] - typed_data 1.3.2 [collection] - 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.8.0 - watcher 1.1.0 [async path] - web_socket_channel 2.4.0 [async crypto stream_channel] - webkit_inspection_protocol 1.2.0 [logging] - xml 6.3.0 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```