Dart cascade methods
Find this at dartpad.dartlang.org/?source=4c1acd5c-1f36-4cb9-857d-c63b8747e647.
Created with <3 with dartpad.dartlang.org.
Dart cascade methods
Find this at dartpad.dartlang.org/?source=4c1acd5c-1f36-4cb9-857d-c63b8747e647.
Created with <3 with dartpad.dartlang.org.
// shows how to use cascade method calls in Dart | |
class Cat { | |
String color; | |
Cat(this.color); | |
meow() { print("meow"); } | |
yawn() { print("yawn"); } | |
show() { print("furry ${color} hair"); } | |
} | |
void main() { | |
Cat dingdong = new Cat("grey"); | |
dingdong | |
..meow() | |
..yawn() | |
..show(); | |
} |