PokemonApp icon indicating copy to clipboard operation
PokemonApp copied to clipboard

The return type 'PokeDetail' isn't a 'Widget', as defined by anonymous closure

Open Ledjob opened this issue 6 years ago • 0 comments

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, )));

Ledjob avatar Jan 13 '20 16:01 Ledjob