I´m newbie to flutter and reveice one exception about route and paginator in Flutter.
EXCEPTION CAUGHT BY GESTURE
The following assertion was thrown while ha
This is because you have instantiated two MaterialApp
widgets. You need to remove the one in MyApp
class and may change it to Scaffold
instead like this:
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
// ...
return new ListTile(
onTap: () {
Navigator.pushNamed(context, "/listadecompras");
},
// ...
}
What happened in your code is the route is trying to resolve for the nearest MaterialApp
which has no route definition. That said you should use only one MaterialApp
as the root of your widget tree.
If a new file is created and you are defining a route for that new file, its better to re-run the app rather than hot reloading.It worked for me!