Course

Dart from the ground up

The language behind Flutter, from the first line to a report

  • Beginner
  • 12 chapters
  • 213 min read

Learn Dart by running it: main and print, values in var and final, the built-in types, string interpolation and fixed decimals, if and switch over an enum, four kinds of loop, functions with optional and named parameters, lists and maps, the calls that replace whole loops, classes with getters and their own text form, inheritance and interfaces, null safety with fallbacks and the one bang to avoid, errors caught rather than crashed, and a sales report that uses the whole course at once.

What You'll Learn

  • Write and run a Dart program, and know what the compiler expects of it
  • Hold values in var and final, and tell whole numbers from decimals
  • Build text with interpolation, and round a price to the decimals you want
  • Choose a path with if and a case with switch, over numbers and over an enum
  • Repeat work with a counted for loop, for in, while and do while
  • Write functions with defaults, named arguments and one-line arrow bodies
  • Keep values in a list and lookups in a map, and add, remove, find and sort
  • Replace loops with map, where, fold and reduce, one question at a time
  • Model a record as a class, with fields, getters and a readable text form
  • Share behaviour with extends, and promise a shape with implements
  • Handle a missing value with the safe call and a fallback, and catch a failure
  • Assemble a sales report from a record class, a filter, an order and a total

Prerequisites

  • No programming experience needed — this course starts at the first line
  • Any other language you know will make the early chapters quick

Course Content

  1. 01
    Your first Dart program

    What Dart runs on, the main function every program begins at, print and the line breaks it adds, and the comments that are for the reader rather than for the compiler.

    Beginner · 14 min read

    Not started
  2. 02
    Values, names and types

    Holding a value under a name with var and final, the built-in types for whole numbers, decimals, text and truth, and the two kinds of division that catch people out.

    Beginner · 16 min read

    Not started
  3. 03
    Text, interpolation and formatting

    Joining text with the plus sign, dropping values into a string with a dollar sign, and turning a number into the wording you want with toStringAsFixed.

    Beginner · 15 min read

    Not started
  4. 04
    Decisions: if, else and switch

    Choosing a path with if and else, picking one of two values with a short expression, and naming the cases of a choice with switch and an enum.

    Beginner · 17 min read

    Not started
  5. 05
    Loops: for, for in, while and do

    Repeating work a counted number of times, walking through a list one value at a time, and repeating while a condition holds or until it has held once.

    Intermediate · 16 min read

    Not started
  6. 06
    Functions and their parameters

    Naming a piece of work, giving it inputs and an answer, letting a caller leave an argument out, and passing arguments by name so the call reads like a sentence.

    Intermediate · 18 min read

    Not started
  7. 07
    Lists and maps

    Keeping many values in a list and many lookups in a map, reading them by position or by key, and the handful of calls that add, remove, find and order what is inside.

    Intermediate · 19 min read

    Not started
  8. 08
    Doing work on a whole list at once

    Replacing loops with calls that each answer one question: map to change every value, where to keep the ones that pass a test, and fold and reduce to boil a list down to one value.

    Intermediate · 18 min read

    Not started
  9. 09
    Classes: values with behaviour

    Grouping values with the work that belongs to them, writing a constructor that fills the fields, adding getters that look like values, and overriding toString so printing an object says something useful.

    Advanced · 19 min read

    Not started
  10. 10
    Sharing behaviour: extends, implements and abstract

    One class taking the fields and methods of another with extends, an abstract class saying what every kind must be able to do, and implements for a class that promises a shape without borrowing any code.

    Advanced · 20 min read

    Not started
  11. 11
    Missing values and calls that fail

    Types that say a value may be absent, the safe call and the fallback that handle one, why the bang is the last resort, and how throw with try and catch keeps a failure from ending the program.

    Advanced · 20 min read

    Not started
  12. 12
    Putting it together: a sales report

    A capstone that uses the whole course once: a class holding a record, a getter for the line total, a filter and an ordering built from the calls in chapter eight, and a report printed one line at a time.

    Advanced · 21 min read

    Not started