PokemonApp
PokemonApp copied to clipboard
The return type 'PokeDetail' isn't a 'Widget', as defined by anonymous closure
I was following the code. I got an error. PokeDetail should be a widget so I don't understand why I have this error. here is the code :
import 'pokemonddetail.dart'
Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Poke App"), backgroundColor: Colors.cyan, ), body: pokeHub == null ? Center( child: CircularProgressIndicator(), ) : GridView.count( crossAxisCount: 2, children: pokeHub.pokemon .map((poke) => Padding( padding: const EdgeInsets.all(2.0), child: InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => PokeDetail( pokemon: poke, ))); },
the error is :
MaterialPageRoute( builder: (context) => PokeDetail( pokemon: poke, )));