Group Group Group Group Group Group Group Group Group

@override as an explicit or an implicit annotation

I just started reading your book. Great job.

I particularly like your code annotations, with notes such as // 1 in the code keyed to the related description in your text:

  1. A widget’s build() method is the entry point for composing together other widgets to make a new widget.

You have a wonderful opportunity to do a similar annotation for an annotation that appears everywhere and that the official Dart documentation doesn’t manage to clarify:

@override

See: override constant - dart:core library - Dart API

Nobody seems to have mentioned, in a clear way, the motivation (and the tradeoffs) behind @override.

Search for @override in your book and you’ll get 82 results. Unfortunately, all of them are occurrences of the annotation and, as far as I can tell, there’s not a single annotation regarding why.

In any case (whether @override must be explicit or could be implicit), please consider providing a good description of the concept before the first appearance of @override in section 2 (Hello, Flutter).

Thanks for an excellent book.

2 Likes

@panchoybook Thanks for your kind words!
We’ll definitely add some more details about @override

In the meantime you can check out our Dart book which provide more details about it: Dart Apprentice, Chapter 6: Classes | raywenderlich.com

2 Likes

Thanks for your consideration, @funkyboy. That will make your book unique in the Flutter industry. The idea is quite simple but, somehow, quite elusive:

Describe a concept before using it.

Euclid did it. Go for it!

I really appreciate the link to your Dart book.

My best to you and all of your colleagues, who are obviously working hard and with enthusiasm to benefit the rest of us.

1 Like

Ok. Here’s some info on @override straight from the source of truth for Dart:

To find both @override and overriding on this web page, search for the partial word:
overrid

This info is good but you have to dig for it and search for it explicitly. As one of my physics professors used to say: You have to know everything before you can do anything.

I still believe that you have the golden opportunity to do a superb job introducing and clarifying this concept before using it (or, following your annotation style, as you use it).

Thanks.

1 Like

Another useful piece from the linter: annotate_overrides

https://dart-lang.github.io/linter/lints/annotate_overrides.html

2 Likes