Skip to content

Instantly share code, notes, and snippets.

@devoncarew
Created March 30, 2015 00:03
Show Gist options
  • Save devoncarew/58cbd0407b325990390e to your computer and use it in GitHub Desktop.
Save devoncarew/58cbd0407b325990390e to your computer and use it in GitHub Desktop.
nosuchmethod
class Person {
Date birthdate;
int get age => new DateTime.now().difference(birthdate).inYears;
noSuchMethod(i) => super.noSuchMethod(i);
}
void main() {
var p = new Person()..birthdate = new DateTime(1978);
print(p.age);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment