Cascade Operator in Dart
In this article we will discuss about cascade operator and how to use them in dart programs.
📚 Summary
Cascades (..)
allow you to perform a sequence of operations on the same object.
In other words we can make operations like multiple function call or multiple value assignment sequentially over objects in a single statement.
🔭 Implementation
Consider the following Student
class having two attributes (name
, id
) and two different methods.
👉 Sample code without
cascade operator:
In order to understand cascade operator, let’s first try to access the attributes and methods in this Student
class without using cascade
operator.