operators 

Send to Kindle
home » snippets » dart » operators



Snippets

Cascade operator:  ..

Use the cascade operator (..) when you want to perform a series of operations on the members of a single object:

query('#button')
    ..text = 'Click to Confirm'                        // Get an object. Use its
    ..classes.add('important')                         // instance variables
    ..onClick.listen((e) => window.alert('Confirmed!')); // and methods.

Integer division operator:  ~/

assert(5 ~/ 2 == 2);    // Result is an integer