Errata for Flutter Apprentice 2nd Edition

Hi.

9 : Shared Preferences

recipe_list.dart

// Show a loading indicator while waiting for the movies

// Show a loading indicator while waiting for the recipes

Hi.

Just a little detail.

In serialization you give the example of a json file. But you donā€™t mention the real file at the beginning of the chapter (In the asset folder). Without seeing the real file, we wonder about the ingredients, weight ā€¦

Networking in flutter :

Edamam.com release a V2 API.

So we have to click on ā€œOlder versionā€ to use V1

Ch 10.Serialization With JSON, there is a little typo to switch:

ā†’ Then youā€™d add a toJson() factory method and a fromJson() method:

toJson is not factory, fromJson is a factory method

2 Likes

Chapter 7 :arrow_right: Adding the log out capability

In the snippet bellow, for consistency : _selectedTab = 0; should be _selectedTab = FooderlichTab.explore;

void logout() {
  // 12
  _loggedIn = false;
  _onboardingComplete = false;
  _initialized = false;
  _selectedTab = 0;

  // 13
  initializeApp();
  // 14
  notifyListeners();
}
1 Like

From mitai

Chapter 7 :arrow_right: Handling tab selection

For the // TODO: Update userā€™s selected tab the suggested code is

Provider.of<AppStateManager>(context, listen: false)
  	.goToTab(index);

but we already have a reference to AppStateManager in the builder closure

builder: (context, appStateManager, child) {

and we can simply use it as follow:

onTap: appStateManager.goToTab,

Excellent book.

At the page: https://www.raywenderlich.com/books/flutter-apprentice/v2.0/chapters/3-basic-widgets

item: Adding the IconButton widget

The next phone screen image shows the ā€œsmoothiesā€ and ā€œrecipeā€ texts but they have not been added yet.

Misleading.

Mauricio

Stream chapter

Just a typo (underscore):

  1. _recipeStream and _ingredientStream are private fields for the streams. These will be captured the first time a stream is requested, which prevents new streams from being created for each call.

Chapter 7, under ā€œHandling Pop Eventsā€.

Thereā€™s a typo in the first line. ā€œLocate // TOOD:...ā€ should be ā€œLocate // TODO:...ā€.

In the same section, in the code snippet to be copied, thereā€™s an footnote marker // 6 but no corresponding footnote.

8. Deep Links & Web URLs :arrow_right: Converting an AppLink to a URL string

The provided implementation of toLocation() doesnā€™t do logic defined in the explanation section.
I have tried to implement it as the explanation suggest:

switch (location) {
      case kLoginPath:
      case kOnboardingPath:
      case kProfilePath:
        return location;
      case kHomePath:
        var loc = '$kHomePath';
        loc += currentTab == null ? '' : '?';
        loc += encodeKeyValPair(key: kTabParam, value: currentTab?.toString());
        return Uri.encodeFull(loc);
      case kItemPath:
        var loc = '$kItemPath';
        loc += itemId == null ? '' : '?';
        loc += encodeKeyValPair(key: kIdParam, value: itemId);
        return Uri.encodeFull(loc);
      default:
        return kHomePath;
    }

PS: I have declared location field as non-nullable String to simplify the logic.

in chapter 2, I can not add image. i am always receiving this error below. please help. thanks.

Could not update files on device: FileSystemException: Cannot open file, path = ā€˜C:\Users\user\Desktop\flutterDevFolder\recipes\assets\15452035777_294cefced5_c.jpgā€™ (OS Error: The system cannot find the file specified.
, errno = 2)

@jomoka @mkatz
Ch6: I was following the book example using VSCode. Section 6.9: The highlighted line in the snapshot below did not hold true for me. The squiggles remained in place and did not disappear. link.

image

Ch7: There is a missing indentation in the following code segment @ 7.11 Navigation. link.

image

1 Like

router-diagram

image

Who calls setNewRoutePath() ?

I tried testing deep link in my terminal ,this what am seeing
IMG_20211110_123351_295

Am facing this error even after adding Splash screen to the app route (p.g 295) => .The Navigator.pages must not be empty to use the Navigator.pages API.

Reference
Book chapter: 7. page 294.

Any help please.

1 Like

Thank you @alilosoft for taking the time to report this. I was previously reported on 5-October.

alilosoft

11h

Chapter 6.

// TODO 22: Add Row to group (name, date, importance)

is missing the Row widget.