Skip to content

Instantly share code, notes, and snippets.

@roboli
Created April 6, 2024 19:11
Show Gist options
  • Save roboli/56c887684026bb25fc3fd35761b0a94c to your computer and use it in GitHub Desktop.
Save roboli/56c887684026bb25fc3fd35761b0a94c to your computer and use it in GitHub Desktop.
Dart: Access Mixins and Class instance variables
mixin Address on Person {
late final String address;
say() {
print("Name: $name, Address: $address");
}
}
class Person {
late final String name;
Person(this.name);
}
class Child extends Person with Address {
Child(super.name, address) {
this.address = address;
}
}
void main() {
final one = Child("Robs Oliver", "1st St. Wonderland");
one.say();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment