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
======== Exception caught by foundation library ====================================================
The following assertion was thrown while dispatching notifications for GoRouteInformationProvider:
Tried to use `context.select` outside of the `build` method of a widget.
Any usage other than inside the `build` method of a widget are not supported.
'package:provider/src/inherited_provider.dart':
Failed assertion: line 266 pos 12: 'widget is LayoutBuilder || debugDoingBuild'
go router documentation :
/// If [BuildContext.dependOnInheritedWidgetOfExactType] is used during the/// redirection (which is how `of` method is usually implemented), a/// re-evaluation will be triggered if the [InheritedWidget] changes.finalGoRouterRedirect? redirect;
context.watch and context.select use dependOnInheritedWidgetOfExactType but an assert prevent them to be used inside go_router redirect.
If I edit provider code as bellow it works well, redirection are well re-evaluated as expected (it's maybe not the good solution, I just did it for demo purpose) :
To Reproduce
Call context.watch or context.select inside GoRouter route redirect callback.
Expected behavior
Context.watch or context.select should be callable inside GoRouter redirect.
The text was updated successfully, but these errors were encountered:
Describe the bug
go router documentation :
context.watch and context.select use dependOnInheritedWidgetOfExactType but an assert prevent them to be used inside go_router redirect.
If I edit provider code as bellow it works well, redirection are well re-evaluated as expected (it's maybe not the good solution, I just did it for demo purpose) :
To Reproduce
Call context.watch or context.select inside GoRouter route redirect callback.
Expected behavior
Context.watch or context.select should be callable inside GoRouter redirect.
The text was updated successfully, but these errors were encountered: