Last active
February 7, 2019 20:31
-
-
Save dsrenesanse/06b2b5b2a3fdc317a9943f5f6734f4aa to your computer and use it in GitHub Desktop.
State
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
import 'dart:async'; | |
class ScreenState { | |
final valueElementState = _ElementState(value: 0); | |
/// Global state describes a screen state | |
} | |
class _ElementState{ | |
/// Element state describes a view state | |
var value; /// You can remove this line if you don't need hold a value | |
final id; /// Will need to save state in database | |
final valueBroadcaster = StreamController.broadcast(); | |
get valueStream => valueBroadcaster.stream; | |
_ElementState({this.value, this.id}){ | |
valueBroadcaster.add(value); | |
/// Adding a default value in to the StreamController | |
} | |
} | |
final state = ScreenState(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment