Skip to content

Instantly share code, notes, and snippets.

@rhmndnt
Created October 2, 2022 23:39
Show Gist options
  • Save rhmndnt/8552747336bd7bf84555cabebc87e6d9 to your computer and use it in GitHub Desktop.
Save rhmndnt/8552747336bd7bf84555cabebc87e6d9 to your computer and use it in GitHub Desktop.
Dart Mixins Example
mixin Swimmer {
void swim() {
print("swim");
}
}
mixin Walker {
void walk() {
print("walk");
}
}
mixin Fyler {
void swim() {
print("fyler");
}
}
class Salmon with Swimmer {}
class Duck with Swimmer, Walker {}
void main() {
final salmon = Salmon();
salmon.swim();
final duck = Duck();
duck.swim();
duck.walk();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment