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
- The Cascade Operator (..)
- Null-Shorting Cascades (?..)
- Spread and Null-Aware Spread
- Collection if and for