-
-
Save Vanethos/51f074c0ffabaf210ee88990296f3405 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
import 'package:rxdart/rxdart.dart'; | |
class ABloc { | |
/// Input from the user | |
var _inputSubject = PublishSubject<int>(); | |
Sink<int> get inputSink => _inputSubject.sink; | |
/// Output for the user | |
var _outputSubject = PublishSubject<int>(); | |
Stream<int> get outputStream => _outputSubject.stream; | |
ABloc() { | |
/// Get the input stream, add 1 and return to the view | |
_inputSubject | |
.stream | |
.listen((value) => _outputSubject.add(value + 1)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment