Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ledjob opened this issue Jan 13, 2020 · 0 comments

Comments

@Ledjob
Copy link

Ledjob commented Jan 13, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant