FlutterFever / Dart / Dart basics Dart / Learning path
Dart basics Install the SDK and learn values, collections, functions, objects and null safety.
How to use this path Install the SDK and learn values, collections, functions, objects and null safety. Follow the chapter order on your first pass; use the topic directory when reviewing a specific question. Predict an example, run it, then change one input and explain the result.
Complete server, file and test examples belong in a local Dart project. Browser-supported language examples load the compiler only when requested.
What this section covers Build a typed program, validate input and explain the data used by an everyday app.
Install Dart, run a program and learn values, operators, strings and control flow.
Install and verify Dart SDK Choose the Dart SDK included with Flutter or install standalone Dart, then verify which executable your tools use. Your first Dart project Create a package, find its entry point and verify formatting, analysis and execution. Variables and types Use var, final and const deliberately, and let Dart types help you express what a value means. Operators and numbers Use integer minor units, arithmetic, comparisons and boolean rules for a small order. Strings, parsing and interpolation Normalize text, parse optional numbers and avoid treating malformed input as valid data. Conditions and loops Choose branches, iterate with for and while, and use break and continue intentionally. Types, casts and exceptions Use static types, safe checks and explicit exceptions instead of relying on dynamic access. Collections and control flow Choose lists, sets and maps, then use conditions and loops to express a small learning-plan example. Manage real collections, construct data conditionally and transform values deliberately.
Lists and sorting Add, filter, sort and copy a list without accidentally changing the original order. Sets, maps and lookup Use set membership and typed map updates for a practical stock summary. Collection builders Build request fields and menu items with conditional, spread and null-aware elements. Iterable and aggregation Transform, filter and aggregate typed data while understanding lazy evaluation. Name operations, choose parameter contracts and use closures and callbacks.
Functions and named parameters Use explicit inputs, return values and named parameters to make a small Dart function understandable at the call site. Transforming collections Use where, map and fold to filter data, create labels and calculate a result without mutating the original list. Closures and scope Capture configuration deliberately and keep independent function instances from sharing accidental state. Callbacks and function types Pass behavior through a typed callback instead of coupling a workflow to one output channel. Exceptions and result contracts Choose an explicit boundary for parsing errors and preserve actionable failure information. Callable objects and tear-offs Pass behavior without calling it early and give configured operations a clear owner. Build domain models with constructors, explicit nullability and controlled mutation.
Classes and models Create an immutable Dart model with a constructor, getter and behavior that belongs with the data. Null safety Use nullable types, checks and defaults to handle missing data without treating the non-null assertion as a shortcut. Constructors and factories Use named constructors, initializer lists, factories and const objects for deliberate model creation. Getters, setters and privacy Expose readable state while keeping mutation rules inside the owning object. Enums and domain states Represent a finite set of states with meaningful data and behavior. Immutable models and copyWith Create a changed model without mutating a shared object and distinguish shallow from deep immutability.