0

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.

anonymous-dev
  • 2,897
  • 9
  • 48
  • 112

2 Answers2

0

Use try-catch block.

try { // your code... } catch(e) { final snackBar = SnackBar(content: Text('Error ${e}'),);}

Kamnag R
  • 19
  • 3
0

Set a MyErrorPageScreen Widget and then inside MaterialApp.router -> routerConfig, set

     errorBuilder: (context, state) => MyErrorPageScreen()