You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
on flutter web
When one manually changes the url so it points to an existing route (ex: entries) , the app will print an exception on the console and reload the "jobs" route (when signed in). The message in the console only appears when the app runs locally, on firebase hosting there is no message (the reload to "jobs" still occurs).
This behavior makes it very complicated to implement "email link authentication" with firebase auth because the email signin logic which is under another route will never run.
I blamed go_router which I learnt to hate and was about to rip it of the app violently when I discovered that the problem was actually AppStartupWidget . ( https://stackoverflow.com/questions/64236640/there-was-no-corresponding-route-through-flutter-web-url )
AppStartupWidget which warms up the providers confuses flutter's navigation because it first creates AppStartupLoadingWidget which is a MaterialApp() but onLoaded(context) creates a MaterialApp with MaterialApp.router(). For some reason the first MaterialApp will handle routing when one changes the url manually and redirects to "jobs".
In order to correct that behavior it was necessary to avoid using AsyncValue.when because it was returning a MaterialApp() first during the loading. I moved the logic to main using the technique (Randal Schwartz) explained here : https://www.youtube.com/watch?v=LEk6AWroib8
UPDATE:
While redacting this issue I found an even simpler solution: remove "MaterialApp(home: Scaffold(body:" and just keep the Center in both AppStartupLoadingWidget and AppStartupErrorWidget. No more MaterialApp and the urls work again.
on flutter web
When one manually changes the url so it points to an existing route (ex: entries) , the app will print an exception on the console and reload the "jobs" route (when signed in). The message in the console only appears when the app runs locally, on firebase hosting there is no message (the reload to "jobs" still occurs).
This behavior makes it very complicated to implement "email link authentication" with firebase auth because the email signin logic which is under another route will never run.
I blamed go_router which I learnt to hate and was about to rip it of the app violently when I discovered that the problem was actually AppStartupWidget . ( https://stackoverflow.com/questions/64236640/there-was-no-corresponding-route-through-flutter-web-url )
AppStartupWidget which warms up the providers confuses flutter's navigation because it first creates AppStartupLoadingWidget which is a MaterialApp() but onLoaded(context) creates a MaterialApp with MaterialApp.router(). For some reason the first MaterialApp will handle routing when one changes the url manually and redirects to "jobs".
final appStartupState = ref.watch(appStartupProvider);
return appStartupState.when(
data: (_) => onLoaded(context),
loading: () => const AppStartupLoadingWidget(),
error: (e, st) => AppStartupErrorWidget(
message: e.toString(),
onRetry: () => ref.invalidate(appStartupProvider),
),
);
In order to correct that behavior it was necessary to avoid using AsyncValue.when because it was returning a MaterialApp() first during the loading. I moved the logic to main using the technique (Randal Schwartz) explained here :
https://www.youtube.com/watch?v=LEk6AWroib8
My changes: master...devloic:starter_architecture_flutter_firebase:master
UPDATE:
While redacting this issue I found an even simpler solution: remove "MaterialApp(home: Scaffold(body:" and just keep the Center in both AppStartupLoadingWidget and AppStartupErrorWidget. No more MaterialApp and the urls work again.
Related issue
#148
The text was updated successfully, but these errors were encountered: