Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find a generator for route "home-page" in the _MaterialAppState

I am getting exception when I trying to navigate from one view to another in flutter app.

I/flutter ( 2199): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
I/flutter ( 2199): The following assertion was thrown while handling a gesture:
I/flutter ( 2199): Could not find a generator for route "home-page" in the _MaterialAppState.
like image 960
Code Hunter Avatar asked Sep 19 '18 12:09

Code Hunter


2 Answers

Use

Navigator.push(context, new MaterialPageRoute(
  builder: (context) =>
     new MyHomePage())
  );

Instead of

Navigator.of(context).pushNamed('/home-page');
//or
Navigator.pushedName(context, '/home-page');
like image 96
F-1 Avatar answered Oct 20 '22 00:10

F-1


This message tells, that in route list, the route you search aren't listed. So, check if in your MaterialApp->routes have your specified route.

like image 33
Dumitru Boaghi Avatar answered Oct 20 '22 00:10

Dumitru Boaghi