Created
March 21, 2020 13:52
-
-
Save zafarivaev/b444f060628a3ac7b63c21f8e62cec50 to your computer and use it in GitHub Desktop.
This file contains 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
mixin WorkerDelegate { | |
void onWorkDone(); | |
} | |
class Manager with WorkerDelegate { | |
void onWorkDone() { | |
print("Work was done"); | |
} | |
} | |
class Worker { | |
WorkerDelegate delegate; | |
void doWork() { | |
delegate.onWorkDone(); | |
} | |
} | |
void main() { | |
final manager = Manager(); | |
final worker = Worker(); | |
worker.delegate = manager; | |
worker.doWork(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment