0PricingLogin
Dart Academy · Lesson

The Cascade Operator (..)

Chain calls on one object.

The Repetition Problem

When you set up one object, you often repeat its name on every line. Dart's cascade lets you skip that repetition and stay focused on the work.

Meet the Double Dot

The cascade operator is two dots, written as two periods. It runs a method or sets a field on an object without ending the chain.

var b = StringBuffer()
  ..write('Hi')
  ..write('!');

All lessons in this course

  1. The Cascade Operator (..)
  2. Null-Shorting Cascades (?..)
  3. Spread and Null-Aware Spread
  4. Collection if and for
← Back to Dart Academy