Closed masewo closed 1 year ago
Nevermind, my bad.
I thought I narrowed it down to a problem related to the fact, that flutter_web_auth
opens a new tab on the web platform, causing an unwanted rebuild (that I didn't see happen in the code_gen
example), but it also seemed connected to the assumption, that more than one AuthNotifier
or RouterNotifier
might exist.
But I did not see the problem happen with an example using a simple html.open
.
At the end I - as a riverpod
beginner - found my main problem:
ProviderContainer
to trigger the login
method instead of using ref.watch
.Also there were some side problems, which were causing confusions on my side while analysing the problem:
flutter_web_auth
plugin resulting in a not resolving authenticate
future.ref.read
instead of ref.watch
at a lot more places causing other issues.CircularDependencyError
and so on...Hope this might help someone in the future - or my future I...
When I try to add the
flutter_web_auth
dependency to thelogin
method, then no login is happening on the web platform. It seems like thebuild
methodAuthNotifier
is triggered again (because of the new opened and then closing tab) and thebulid
method ofRouterNotifier
is not triggered. Tried to setkeepAlive: true
but it did not help.When you hot restart the app, then you are logged in.
Running following code for the
web
platform fails:Example code: