This error has a lot of solutions. But I am getting this error. I tried several ways at this site. but could not get a solution. This is my code
@override
Widget build(BuildContext context) {
// TODO: implement build
SystemChrome.setEnabledSystemUIOverlays([]);
return MaterialApp(
routes: <String, WidgetBuilder>{
'/homepage': (context) => MyApp(),
'/loginpage': (BuildContext context) => new LoginPage()
},
home: Scaffold (
body: Center(
child: GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/loginpage');
},
child: Image(
width: 100.0,
height: 100.0,
image: AssetImage('assets/images/icon.png'),
),
)
),
),
);
}