Group Group Group Group Group Group Group Group Group

Chapter 5 Flutter Apprentice - Scrollable Widget

Hello, I do not understand why I get error,
If this is as it is in the book.
I stay at this point → Adding the Nested ListView
I’m using the version of Flutter 2.7.0 that is from the book.
what is the problem if I do not mark error any kind

class ExploreScreen extends StatelessWidget {
  final mockService = MockFooderlichService();
  ExploreScreen({Key key}) : super(key: key);

  Widget build(BuildContext context) {
    return FutureBuilder(
      future: mockService.getExploreData(),
      builder: (context, snapshot) {
        if (snapshot.connectionState == ConnectionState.done) {
          return ListView(scrollDirection: Axis.vertical, children: [
            const SizedBox(height: 16),
              height: 400,
        } else {
          return const Center(
            child: CircularProgressIndicator(),


The getter 'todayRecipes' was called on null.
Receiver: null
Tried calling: todayRecipes

It seems like it failed to get the mock data. In MockFooderlichService, you might want to set a breakpoint in getExploreData() to see if the data is coming out properly.

@sugey i double checked the project files and it seems ok. Would you mind sharing your project file so i can help you check it out? I am also on Flutter 2.2.1, Dart 2.13.1

Hello, thanks for answering, here I pass my repo

I do not know what I did wrong

Hi @sugey

It seems like the parser failed to parse the field of durationInMinutes from the Instruction object.

Screen Shot 2021-06-21 at 11.51.45 AM

class Instruction {
  String imageUrl;
  String description;
  int durationInMinutes;

  Instruction({this.imageUrl, this.description, this.durationInMinutes});

  Instruction.fromJson(Map<String, dynamic> json) {
    imageUrl = json['imageUrl'] ?? '';
    description = json['description'] ?? '';
    durationInMinutes = json['durationInMinutes'] ?? 0;

If you change String durationInMinutes; to int durationInMinutes; it should work.

Please try to pull the latest flta-materials project. We just released edition 1.0 with the latest code.

1 Like

Thank you so much, :star_struck:
I was 3 days trying to solve it, :sneezing_face:

If I have the last version of the code, the bad thing is that they do not properly use Git to show changes

You could tell me what a tool you used to find the error so fast, the console showed me the getExploreData () method,
Then I looked at the Mockfooderlichservice class, then I looked
Exploredata that I had the Explorecipe class and I stayed there.
I check all the model and that variable was ignored.

Is there a tool that shows me the error, how did you show it to me?

@sugey you can probably turn on all exceptions breakpoint. But the compiler should have caught this error. What IDE are you using?

1 Like

Android Studio,
I should have made the exception dialing, :sweat_smile: :sleepy:
Now I can see where the problem was
Thanks for your help @jomoka

1 Like

You are welcome @sugey! Have fun :slight_smile: