# Dart Apprentice: Beyond the Basics

**URL:** https://forums.kodeco.com/c/books/dart-apprentice-beyond-basics/93.md

[Latest](https://forums.kodeco.com/latest.md) · [Categories](https://forums.kodeco.com/categories.md) · [Tags](https://forums.kodeco.com/tags.md)

---

## [Errata for Dart Apprentice: Beyond the Basics 1st Edition](https://forums.kodeco.com/t/errata-for-dart-apprentice-beyond-the-basics-1st-edition/180744)

<div class="topic-metadata">

**Author:** [@jellodiil](https://forums.kodeco.com/u/jellodiil)\
**Replies:** 21\
**Last updated:** [January 31, 2023, 5:16am UTC](https://forums.kodeco.com/t/errata-for-dart-apprentice-beyond-the-basics-1st-edition/180744 "2023-01-31T05:16:47Z")

</div>

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

---

## [About the Dart Apprentice: Beyond the Basics category](https://forums.kodeco.com/t/about-the-dart-apprentice-beyond-the-basics-category/180743)

<div class="topic-metadata">

**Author:** [@jellodiil](https://forums.kodeco.com/u/jellodiil)\
**Replies:** 0

</div>

This is the official forum for our book, Dart Apprentice: Beyond the Basics, available here: https://www.kodeco.com/books/dart-apprentice-beyond-the-basic

---

## [About Future generic type](https://forums.kodeco.com/t/about-future-generic-type/184765)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 4\
**Last updated:** [August 4, 2023, 11:08am UTC](https://forums.kodeco.com/t/about-future-generic-type/184765 "2023-08-04T11:08:11Z")

</div>

I have a question about the Future generic type below The code in the book is: print('Before the future'); final myFuture = Future\<int\>.delayed( Duration(seconds: 1), () =\> 42, ) .then( (value) =\> print(…

---

## [\[share\] verification of await keyword behaviour](https://forums.kodeco.com/t/share-verification-of-await-keyword-behaviour/184784)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 4\
**Last updated:** [August 4, 2023, 11:05am UTC](https://forums.kodeco.com/t/share-verification-of-await-keyword-behaviour/184784 "2023-08-04T11:05:55Z")

</div>

I want to share how I verify the point: everything after await keyword is sent to event queue. When I first come across the code in the book below: Future\<void\> main() async { print('Before the future'); final …

---

## [\[Suggestion\] Explain mixin plus the on keyword](https://forums.kodeco.com/t/suggestion-explain-mixin-plus-the-on-keyword/184460)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [July 31, 2023, 7:38pm UTC](https://forums.kodeco.com/t/suggestion-explain-mixin-plus-the-on-keyword/184460 "2023-07-31T19:38:04Z")

</div>

Hi don’t know why I can think of so many questions in this chapter of enhanced enum. About the code of mixin in enhanced enum enum Fruit with Describer { cherry, peach, banana, } enum Vegetable with Describer { …

---

## [About Challenge 2 solution code in Chapter 6 Mixins](https://forums.kodeco.com/t/about-challenge-2-solution-code-in-chapter-6-mixins/183836)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [June 23, 2023, 1:25pm UTC](https://forums.kodeco.com/t/about-challenge-2-solution-code-in-chapter-6-mixins/183836 "2023-06-23T13:25:57Z")

</div>

The solution code try to implements Comparable\<Platypus\> My code don’t have the \<Platypus\> type declaration, see below: class Platypus extends Animal with EggLayer implements Comparable { @override void eat() { …

---

## [About fold function in Chapter 2 anonymous function](https://forums.kodeco.com/t/about-fold-function-in-chapter-2-anonymous-function/183226)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 3\
**Last updated:** [June 26, 2023, 2:17am UTC](https://forums.kodeco.com/t/about-fold-function-in-chapter-2-anonymous-function/183226 "2023-06-26T02:17:08Z")

</div>

const evens = \[2, 4, 6, 8, 10, 12\]; final total = evens.fold\<int\>( 0, (sum, element) =\> sum + element, ); Hi I don’t quite understand why I need to add \<int\> after fold? What is the implication of it? However, I co…

---

## [\[Share\] Interesting behaviour for mixin](https://forums.kodeco.com/t/share-interesting-behaviour-for-mixin/183803)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 3\
**Last updated:** [June 19, 2023, 10:15am UTC](https://forums.kodeco.com/t/share-interesting-behaviour-for-mixin/183803 "2023-06-19T10:15:38Z")

</div>

Hi I would like to share an interesting behaviour below: See the code: mixin EggLayer { void layEggs() { print('Plop plop'); } } mixin Flyer { void fly() { print('Swoosh swoosh'); } } abstract cla…

---

## [My first few thoughts about record, pattern and class modifier](https://forums.kodeco.com/t/my-first-few-thoughts-about-record-pattern-and-class-modifier/188203)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [June 12, 2023, 7:59am UTC](https://forums.kodeco.com/t/my-first-few-thoughts-about-record-pattern-and-class-modifier/188203 "2023-06-12T07:59:15Z")

</div>

Here are some thoughts after reading the documentation, I am not intend to be original and any examples are dedicated to their original authors. Records Reference doc: Records The documentation may be somewhat insuffic…

---

## [Dart 3 Released!](https://forums.kodeco.com/t/dart-3-released/187270)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [June 11, 2023, 3:25pm UTC](https://forums.kodeco.com/t/dart-3-released/187270 "2023-06-11T15:25:17Z")

</div>

Dart 3 Released! Dart 3 is released with new flutter version. Quick overview Flutter at Google I/O 2023 in 5 minutes: https://youtu.be/a0Da8TNMTyM Dart new feature blog post: Announcing Dart 3. 100% sound null safety. …

---

## [\[further study\] about flutter development](https://forums.kodeco.com/t/further-study-about-flutter-development/186051)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [April 10, 2023, 9:26am UTC](https://forums.kodeco.com/t/further-study-about-flutter-development/186051 "2023-04-10T09:26:15Z")

</div>

Hi, I finally finished everything, taking notes on the book, run the code, do all the challenges, it is a long journey actually. If it is a simple mere reading, the book is not very long. Most of the time is on thinking …

---

## [\[sidetracked topic\] about recursive function](https://forums.kodeco.com/t/sidetracked-topic-about-recursive-function/184086)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 4\
**Last updated:** [April 8, 2023, 6:27am UTC](https://forums.kodeco.com/t/sidetracked-topic-about-recursive-function/184086 "2023-04-08T06:27:16Z")

</div>

Chapter 8 uses recursive function to write a tree. I would like to point out that deep recursive function is an inefficient algorithm and programmer should avoid this. See the following code of calculating n-th Fibonacc…

---

## [About using Stream Controllers to build stream](https://forums.kodeco.com/t/about-using-stream-controllers-to-build-stream/185378)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 1\
**Last updated:** [March 22, 2023, 8:36am UTC](https://forums.kodeco.com/t/about-using-stream-controllers-to-build-stream/185378 "2023-03-22T08:36:48Z")

</div>

Hi About the last part of chapter 13 Streams. The book introduce a method to build a stream from scratch using the StreamController class. The code in main starts with Future\<void\> main() async. Isn’t better just to kee…

---

## [About error handling in stream section](https://forums.kodeco.com/t/about-error-handling-in-stream-section/185029)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [March 14, 2023, 11:20am UTC](https://forums.kodeco.com/t/about-error-handling-in-stream-section/185029 "2023-03-14T11:20:17Z")

</div>

About using try-catch approach for error handling in Chapter 13: Streams. The code is: try { final file = File('assets/text\_long.txt'); final stream = file.openRead(); await for (var data in stream) { print(d…

---

## [Why need to use Completer class](https://forums.kodeco.com/t/why-need-to-use-completer-class/184951)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [March 11, 2023, 9:46am UTC](https://forums.kodeco.com/t/why-need-to-use-completer-class/184951 "2023-03-11T09:46:58Z")

</div>

About the section Creating a Future From Scratch in Chapter 12 Futures, I just don’t understand why I need to use Completer class to build a Future instance. The code using async keyword just work and very readable: …

---

## [About use of http package in Chapter 12 Futures](https://forums.kodeco.com/t/about-use-of-http-package-in-chapter-12-futures/184909)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [March 9, 2023, 12:10pm UTC](https://forums.kodeco.com/t/about-use-of-http-package-in-chapter-12-futures/184909 "2023-03-09T12:10:43Z")

</div>

In Chapter 12 Futures, is http a third party package developed by someone else. Therefore we need to add the line http: ^0.13.5 in the dependencies section in the pubspec.yaml file? This syntax will specify Dart to load…

---

## [Simplify the mixin code of enhanced enum with extension](https://forums.kodeco.com/t/simplify-the-mixin-code-of-enhanced-enum-with-extension/184426)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 4\
**Last updated:** [February 27, 2023, 5:42am UTC](https://forums.kodeco.com/t/simplify-the-mixin-code-of-enhanced-enum-with-extension/184426 "2023-02-27T05:42:17Z")

</div>

Hi I believe that the mixin code in the last part of Chapter 9: enhanced enum can be simplified using an extension: enum Fruit{ cherry, peach, banana, } enum Vegetable{ carrot, broccoli, spinach, } extensi…

---

## [About using Generic in enhanced enum](https://forums.kodeco.com/t/about-using-generic-in-enhanced-enum/184429)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 1\
**Last updated:** [February 25, 2023, 9:55am UTC](https://forums.kodeco.com/t/about-using-generic-in-enhanced-enum/184429 "2023-02-25T09:55:34Z")

</div>

The generic part of the code: enum Default\<T extends Object\> { font\<String\>('roboto'), size\<double\>(17.0), weight\<int\>(400); const Default(this.value); final T value; } And I find that it works completely we…

---

## [Simplifying the Day class in enhanced enum chapter](https://forums.kodeco.com/t/simplifying-the-day-class-in-enhanced-enum-chapter/184430)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 1\
**Last updated:** [February 25, 2023, 9:40am UTC](https://forums.kodeco.com/t/simplifying-the-day-class-in-enhanced-enum-chapter/184430 "2023-02-25T09:40:23Z")

</div>

Hi, I find that the Day class code: enum Day { monday, tuesday, wednesday, thursday, friday, saturday, sunday; Day operator +(int days) { final numberOfItems = Day.values.length; final i…

---

## [\[Suggestion\] moving the operator overloading explanation to book 1](https://forums.kodeco.com/t/suggestion-moving-the-operator-overloading-explanation-to-book-1/184432)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [February 25, 2023, 9:36am UTC](https://forums.kodeco.com/t/suggestion-moving-the-operator-overloading-explanation-to-book-1/184432 "2023-02-25T09:36:14Z")

</div>

Hi in chapter 9 enhanced enums, I suggest moving the explanation of operator overloading to a suitable place in book1. This is because this is quite similar to method overriding and can be introduced earlier. People can…

---

## [\[fun share\] chatGPT to improve mixin](https://forums.kodeco.com/t/fun-share-chatgpt-to-improve-mixin/183835)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 6\
**Last updated:** [February 14, 2023, 8:08am UTC](https://forums.kodeco.com/t/fun-share-chatgpt-to-improve-mixin/183835 "2023-02-14T08:08:47Z")

</div>

I try to ask chatGPT about improving code using mixin. see below:

---

## [Suggest to improve the challenge in Chapter 4 Abstract class](https://forums.kodeco.com/t/suggest-to-improve-the-challenge-in-chapter-4-abstract-class/183642)

<div class="topic-metadata">

**Author:** [@ellery](https://forums.kodeco.com/u/ellery)\
**Replies:** 2\
**Last updated:** [February 8, 2023, 2:28pm UTC](https://forums.kodeco.com/t/suggest-to-improve-the-challenge-in-chapter-4-abstract-class/183642 "2023-02-08T14:28:25Z")

</div>

Just don’t quite understand the purpose of this exercise. Is it the author wants to let us know even concrete class can be declared abstract? Otherwise, I don’t think there is need to declare the parent class as abstract……

---

## [Gratitude — this is awesome](https://forums.kodeco.com/t/gratitude-this-is-awesome/182956)

<div class="topic-metadata">

**Author:** [@eshfield](https://forums.kodeco.com/u/eshfield)\
**Replies:** 4\
**Last updated:** [February 7, 2023, 10:56pm UTC](https://forums.kodeco.com/t/gratitude-this-is-awesome/182956 "2023-02-07T22:56:45Z")

</div>

I want to thank you for the humor in your books and for this episode especially: This is really fun! Thanks for making the learning so amusing :slight\_smile:

---

## [Generic functions signature](https://forums.kodeco.com/t/generic-functions-signature/182986)

<div class="topic-metadata">

**Author:** [@eshfield](https://forums.kodeco.com/u/eshfield)\
**Replies:** 2\
**Last updated:** [January 28, 2023, 12:25pm UTC](https://forums.kodeco.com/t/generic-functions-signature/182986 "2023-01-28T12:25:19Z")

</div>

PDF, Chapter 8: Generics, Paragraph Creating Generic Functions → Implementing the Function: Node\<E\>? createTree\<E\>(…) { … } Can’t figure out where does the \<E\> in the function name createTree\<E\> come from? I didn’t s…

---

## [Regex unexpected value match](https://forums.kodeco.com/t/regex-unexpected-value-match/182912)

<div class="topic-metadata">

**Author:** [@shakirkasmani92](https://forums.kodeco.com/u/shakirkasmani92)\
**Replies:** 5\
**Last updated:** [January 26, 2023, 7:54am UTC](https://forums.kodeco.com/t/regex-unexpected-value-match/182912 "2023-01-26T07:54:46Z")

</div>

In string validation exercise credit card number should be number and 16 digit long so I tried Regex1 bool validateCreditCardNumber(String number) { final numbersOnly = RegExp(r'^\[0-9\]+$'); final validLength = Reg…
