Errata for Dart Apprentice: Fundamentals 1st Edition

Creating this topic to catch any typos and bugs in the 1st Edition of Dart Apprentice: Fundamentals

PDF, Page 64, Key Points, the line:

User-perceived characters may be composed of one or more code points and are called grapheme characters.

Maybe it would be grapheme clusters, not grapheme characters? Or these terms are identical?

1 Like

Good catch! Thank you! Yes, that was a typo. I’ve updated our source text repository so the online version should get updated soon. (The PDF version and print versions may not get updates until the next major update, though.)

1 Like

PDF, Page 101, the very first line:

Also use verb phases if you want to emphasize that the function does a lot of work

There is a typo in the word phrases

Good catch! Thank you. I’ve updated the text in our github repo. The online version should get updated soon, too.

1 Like

PDF, Page 178, the very bottom paragraph under number 2:

Because an element may be null, you use the .? null-aware access operator to get…

I guess you mean ?.

1 Like

Indeed I did! Thank you. I’ve already made the update.

1 Like

PDF, Page 211, once again the very bottom sentence:

However, when you printed the list, you needed to know all the elements, so Dart
ran through them at that point.

I think it would be better to use some other word instead of the list (maybe iterable or collection) because technically speaking the thing we have printed in the example is not type of List — it is Iterable and can add some misunderstanding to readers.

You’re right. I can see how that would be confusing. I rephrased it like so:

However, when you decided to print reversedIterable, you needed to know all the elements, so Dart ran through them at that point.

1 Like

This is not actually a typo — more like a suggestion — but I’m posting it here because I think the separate topic is too much for such little note.

PDF, Page 220, Paragraph When to Use Lists, Sets, Maps or Iterables says:

  • Choose sets if you’re only concerned with whether something is in the collection or not. This is faster than searching a list.

I think it worth to note also about the ability to quickly remove duplicates from the collection with the help of set due it’s property of holding only unique elements.

1 Like

That’s a good point. Thank you. I opened a new issue in the book repo so that it gets added to the next edition.

1 Like

PDF Page 192.

The code example shows

Iterable<String> myIterable = ['red', 'blue', 'green'];

But the text below it says:

“ But by explicitly writing Iterable<int>”

Should that be Iterable<String> instead?

2 Likes

Yes, it should! I’m not sure what I was thinking when I wrote int. Thank you for catching that and reporting it. I’ve updated the source text so the online version should be updated soon.

1 Like

No worries, glad to be of service.

1 Like

‘Ch3, Challenge 2: What Type?’
Rather a question than an issue, but why do you think for the same code we get different results in Dartpad and VScode:

void main() {
  const value = 10 / 2;
  print(value);
  print(value.runtimeType);
}

VSCode:
5.0
double

Dartpad:
5
int

// using Dart SDK 2.19.0 in both

1 Like

The reason is that in VS Code you run the Dart code natively in the Dart VM (Virtual Machine) while DartPad converts the Dart code to JavaScript to have the ability to run it in the browser. JavaScript has some differences in work with Numbers, check this page of the Dart Documentation for the details.

3 Likes