Errata for Flutter Apprentice 2nd Edition

I forget the section I first noticed this in, but grep all code examples for “TODO;” (TODO followed by semicolon.)

While I suspect colon vs. semicolon doesn’t matter much here - I don’t know if parsers are looking for anything but “TODO” in comments - this was an inconsistency in grammar that popped out at me. You used colon most of the time.

Chapter 12. Under “Handling recipe results”, comment 3 says the Error class is for modelling errors such as incorrect credentials.

  1. Created the Error class to extend Result and hold an exception. This will model errors that occur during an HTTP call, like using the wrong credentials or trying to fetch data without authorization.

However, when the app is run with incorrect credentials, it crashes on line 219 of recipe_list.dart with the following message:

_CastError (type 'Null' is not a subtype of type 'Success<dynamic>' in type cast)

It looks like the Error check isn’t working.

@jomoka @funkyboy i need your help here :sob: :sob:

That output means that the command is running correctly.
The issue is related to the formatting of pubspec.yaml

Entries should be indented like this flta-materials/pubspec.yaml at editions/2.0 · raywenderlich/flta-materials · GitHub

Thanks so much @funkyboy it has worked, but there are still red squiggles in my recipe_model.dart
IMG_20211117_044918_285

By placing cursor on red line you will see error type to help you

Thanks guys @olivaxa @funkyboy, I restarted my Android studio and the red squiggles went out :rofl::rofl::rofl::rofl:

I think there may be minor errors in the followings
Example on p53
Should the SafeArea wrap the Scaffold instead of just the body of the Scaffold so that the AppBar is also inside the SafeArea.
Example on p88
Text inside the AppBar should be wrapped by Center to match the illustrations in the book.
Example on p173, p186
import ‘…/components/components.dart’ should be ‘components.dart’ since they are in the same folder.
Example on p175
No need for top:0, - only need to specify non zero parameters.
Appendix B
A simpler solution is
const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 1),

Chapter 12/ Decoding JSON:

small typo: overwrite → override
image

Section 0: An omission
Under the Before You Begin → Introduction → How to read this book
There is no reference to the contents of Section VI and the last paragraph talks of five instead of six chapters in the sentence “Here’s a breakdown of these five main sections of the book:”
The breakdown of chapters also excludes Section VI

Thanks for reporting to this.
It’s been fixed and will be included in the upcoming release.

1 Like

Chapter 13: This what I get when I search for chicken in the search box, after hot reloading my app.
Screenshot_20211123-162658
@jomoka @funkyboy

1 Like

Chapter 13 → Finding stored recipes and ingredients
In findRecipeIngredients() why do we need to find the recipe first by its id then use that recipe.id to find the ingredients, while we have the recipeId in the first place?
Do I miss something?

image

Are credentials correctly set?

Yes, you are right. I am also confused as you are. An ingredient has recipe.id so why do we need to find the recipe? :thinking:

1 Like

I think the ‘s’ here should be subscription
Ekran Resmi 2021-11-23 23.22.03

1 Like

What credentials are you referring to please

I mean Edamam’s apiId and apiKey.

Good catch. Thanks you!

1 Like