iampawan / iampawan/PokemonApp

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

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
296
Forks
122
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.