I created a public Gist of my experience touring Dart 3’s new features via their Dart Codelab.
- Gist files from Dart’s codelab: Dive into Dart 3’s new OO language enhancements including patterns, records, enhanced switch and case, and sealed classes.
It was intriguing and educational!! 💡
or definitely from when I worked with React (e.g. destructuring ‘records’). Still others were quite new, with one or two that definitely took some time to sink in (e.g. object-destructuring a Duration object with guards).
When learning of Dart 3 records — which help to pass type-safe maps (of a sort) without the need to create a class for them — I couldn’t help but think of a Flutter Bloc analogy, “cubits for classes“.
flutter create –empty patterns_codelab
- “In this course you will experiment with patterns, records, enhanced switch and case, and sealed classes. You will cover a lot of information — yet only barely scratch the surface of these features.”
- “Dart 3 introduces patterns to the language, a major new category of grammar. Beyond this new way to write Dart code, there are several other language enhancements, including:”
- Records for bundling data of different types,
- class modifiers for controlling access, and
- new switch expressions and if-case statements.
- For more information on patterns, see the feature specification.
- For even more specific information, see the individual feature specifications:
Keith D Commiskey