Reputation: 152
while using onTap function i got this error Function expressions can't be named. Try removing the name, or moving the function expression to a function declaration statement.
ListTile(
leading: Icon(Icons.home),
title: Text('Home'),
onTap() =>Navigator.of(context).push(MaterialPageRoute(builder: (context) => HomeScreen()),)
)
Upvotes: 0
Views: 1462
Reputation: 128
You are missing a ':' after onTap. It should read:
ListTile(
leading: Icon(Icons.home),
title: Text('Home'),
onTap: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => HomeScreen())));
Upvotes: 1