Skip to content

Instantly share code, notes, and snippets.

@LiewJunTung
Created December 14, 2019 00:40
Show Gist options
  • Save LiewJunTung/6e8b9b25f1cfb729d8831f97e468a28e to your computer and use it in GitHub Desktop.
Save LiewJunTung/6e8b9b25f1cfb729d8831f97e468a28e to your computer and use it in GitHub Desktop.
class Dog {
String name;
int age;
Dog(this.name, this.age);
}
class DogHouse {
Dog dog;
DogHouse(this.dog);
}
void main(){
var dog = null;
var dogHouse = DogHouse(dog ?? Dog("Fido", 4));
print(dogHouse.dog.name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment