Created
June 5, 2018 09:30
-
-
Save JulianBissekkou/b9b1edc0cbfc256909b7d2e11e554c93 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
class SubscriptionViewModelImpl implements SubscriptionViewModel { | |
var _mailTextController = StreamController<String>.broadcast(); | |
@override | |
Sink get inputMailText => _mailTextController; | |
@override | |
Stream<bool> get outputIsButtonEnabled => _mailTextController.stream | |
.map((email) => EmailValidator.isEmailValid(email)); | |
@override | |
Stream<String> get outputErrorText => outputIsButtonEnabled | |
.map((isEnabled) => isEnabled ? null : "Invalid email"); | |
@override | |
void dispose() => _mailTextController.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment