Skip to content

Instantly share code, notes, and snippets.

@Dalmangyi
Last active August 29, 2019 07:33
Show Gist options
  • Save Dalmangyi/a9aca776f9311705f6b588fff25ba837 to your computer and use it in GitHub Desktop.
Save Dalmangyi/a9aca776f9311705f6b588fff25ba837 to your computer and use it in GitHub Desktop.
Dart cascade operator (..)
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