Mobile development

Stage 1 · Lesson 1 of 10

var, final, const and type inference

Dart fundamentals

works out types for you, so var count = 3 is an int and can never hold a string later. Use a value when it is set once while the app runs. Use a const value when it is known before the app even runs; Dart creates it once and shares it.

uses const to skip rebuilding them. Default to final, and use var only when you reassign. Learn the core types: int, double, String, bool, and dynamic, which turns checking off and which you should avoid.

Learn too, as in 'Hello $name'. Keep in mind that final fixes only the reference, which matters later when you manage state.

Common trapthinking final makes an object frozen: final items = [1, 2] still lets you call items.add(3).

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with

  • GuideFree
    Dart Language Tour

    Google · Beginner

    The official tour: read it in order and rerun every example in DartPad

Practise

  • Dart, TypeScript, Kotlin and Swift tracks with small exercises and free mentor feedback

Keep handy

  • Its Dart tutorial pages work as a quick lookup while you do the tour

Also worth your time

Mark this stage as not done?