typestar

Language basics

27 steps in 9 sets of Dart.

Dart is the language of Flutter, and therefore of a huge share of the cross-platform apps shipping today: one Google-built language that compiles to native ARM and x64, to JavaScript, and to WebAssembly, with hot reload making the edit-run loop feel like a scripting language. It started life in 2011 as a would-be JavaScript replacement, found its calling when Flutter arrived, and grew into a thoroughly modern language: sound null safety since 2021, and records, patterns, and sealed classes since Dart 3.

This tour types the core: var, final and const, string interpolation, switch expressions with relational patterns, named parameters with required and defaults, closures, extension methods, the three collection literals with spread and collection-if, iterable chains, classes with named constructors, mixins, enhanced enums, the null-safety toolkit, records and destructuring, sealed hierarchies, and async from Futures through Streams to sync* generators. The Encore is the cross-language script trio — word frequencies, a grade report, and temperature stats — in idiomatic Dart 3.

Start this tour

Values

Control flow

  • if, else and the ternaryStatements branch with if; the ternary picks a value inline.
  • switch expressionsDart 3's switch yields a value, with relational patterns and _.
  • Loopsfor-in for collections, classic for for counting, while for guards.

Functions

Collections

Classes

Null safety

Records & patterns

  • RecordsBundle values without a class; the shape is the type.
  • PatternsDestructure and test in one motion, with guards.
  • Sealed classesA closed hierarchy the compiler checks exhaustively.

Async

Encore

  • word_freq.dartA word-frequency table from split, map.update, and a two-key sort.
  • grade_report.dartReport cards from a const roster, a switch expression, and padding.
  • temp_stats.dartA week of temperatures: extremes, mean, a bar chart, and swings.

The other Dart tours