Skip to content

Instantly share code, notes, and snippets.

@f3ath
Last active February 14, 2020 07:19
Show Gist options
  • Save f3ath/75910d0c3e52c41f53a68cfa8c0eadd7 to your computer and use it in GitHub Desktop.
Save f3ath/75910d0c3e52c41f53a68cfa8c0eadd7 to your computer and use it in GitHub Desktop.
MVC
abstract class State {}
abstract class Model {
Stream<State> get state;
void doThis();
void doThat();
}
class Controller {
final Model m;
Controller(this.m) {
m.state.listen(_redrawUI);
}
void buttonClick() => m.doThat();
void sliderMove() => m.doThis();
void _redrawUI(State event) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment