Skip to content

Instantly share code, notes, and snippets.

@Zenderable
Created May 30, 2019 20:01
Show Gist options
  • Save Zenderable/9e9dd3917cefff392f270f082b119e5a to your computer and use it in GitHub Desktop.
Save Zenderable/9e9dd3917cefff392f270f082b119e5a to your computer and use it in GitHub Desktop.
Example of constructor in Dart
void main() {
Human mark = Human(186);
Human elon = Human(169);
print(mark.height);
print(elon.height);
}
class Human {
int height;
Human(int height) {
this.height = height;
}
}
@Zenderable
Copy link
Author

Zenderable commented May 30, 2019

void main() {
  Human mark = Human(height: 186);
  Human elon = Human(height: 169);
  print(mark.height);
  print(elon.height);
}

class Human {
  int height;
  Human({this.height});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment