Created
March 17, 2019 08:03
-
-
Save benznest/5dd6322cf330b7fe37cba6990e75d9d3 to your computer and use it in GitHub Desktop.
Optional named parameter in Dart
This file contains hidden or 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
| class Spacecraft{ | |
| String name; | |
| bool available; | |
| Spacecraft({this.name,this.available=true}); | |
| } | |
| class Astronaut{ | |
| String name; | |
| } | |
| main(){ | |
| Spacecraft sc = Spacecraft(name:"USS Discovery"); | |
| print(sc?.name); // USS Discovery | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment