With flutter go router is it possible to disable the error page? Because I want the error to show in a snackbar instead. I tried doing it in the redirect but the error in the redirect seems empty when for example you route to a page that does not exist.
Asked
Active
Viewed 305 times
2 Answers
0
Use try-catch block.
try { // your code... } catch(e) { final snackBar = SnackBar(content: Text('Error ${e}'),);}

Kamnag R
- 19
- 3
-
I don't see how this answer is related to flutter go router? Are you familiar with the package? – anonymous-dev Feb 17 '23 at 06:44
0
Set a MyErrorPageScreen
Widget and then inside MaterialApp.router -> routerConfig, set
errorBuilder: (context, state) => MyErrorPageScreen()

Silverdagger
- 11
- 2