Last active
August 29, 2019 07:33
-
-
Save Dalmangyi/a9aca776f9311705f6b588fff25ba837 to your computer and use it in GitHub Desktop.
Dart cascade operator (..)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
var movie = Movie(); | |
movie..showCount() | |
..showCount() | |
..showCount(); | |
var last = movie..minusCount() | |
..minusCount() | |
..minusCount(); | |
print('last:$last'); | |
} | |
class Movie { | |
int count = 0; | |
void showCount() => print('count:${count++}'); | |
int minusCount() { | |
print('count:${count--}'); | |
return count; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment