Group Group Group Group Group Group Group Group Group

Chapter 5 Understanding Widgets Missing pubspec documentation

I’m one of those developers who like to keep my previous projects to start on since I keep my comments on the project based on Ray Wenderlich’s numbered format /1 /2 /3 that explains exactly what each line of code does.

For this Chapter 5, I used the previous final version of Chapter 4 to iterate on. I added all the required assets and api as the documentation on the 5.1 Getting Started mentioned from the starter project.

Everything worked perfectly fine until I realized my RecipeListView wasn’t returning any data. I started hitting my breakpoints for all my data to troubleshoot and kept returning 0 for all my recipes and I couldn’t understand why since the errors provided wasn’t helpful since there were errors that catch JSON not being returned. It would eventually lead to a dead end on this particular function.

// Loads sample json data from file system
  Future<String> _loadAsset(String path) async {
    return rootBundle.loadString(path);
  }

After troubleshooting after a few hours, comparing my files with the starter project through Git, it turns out the pub spec file had some changes to import the required sample data, but it wasn’t an error caught with the current source code.

  assets:
    - assets/
    - assets/food_pics/
    - assets/magazine_pics/
    - assets/sample_data/
    - assets/profile_pics/

I was hoping that it would be great if the changes on this file was mentioned on the documentation in the beginning. This way, developers like me who iterate on previous projects can work on what we have. Every new file added was explained in great detail but I believe this is a missing component that is required to run the project.

Thank you,
Patrick Ramirez

1 Like

In the first part of chapter 5 there’s

There are new files in this starter project to help you out. Before you learn how to create scrollable widgets, take a look at them.

And the subsequent sections explain what’s new in the project :slight_smile:

1 Like

Right, as I mentioned in my discussion I see that it went through all the files that was added in 5.1. It went on to iterate on the assets folder and lib folder and all the files that was changed. I did not see pubspec file being mentioned at all in this section which is required to be able to get the data source you need for your list views.

Thanks for clarifying. This has been fixed and will be included in the new upcoming release of the book.

1 Like