Skip to content

Instantly share code, notes, and snippets.



Last active Jan 29, 2019
What would you like to do?
A simple bloc example
import 'dart:async';
import 'validators.dart';
import 'package:rxdart/rxdart.dart';
class Bloc with Validators {
final _email = BehaviorSubject<String>();
final _password = BehaviorSubject<String>();
Stream<String> get email =>;
Stream<String> get password =>;
Stream<bool> get submitValid =>
Observable.combineLatest2(email, password, (e, p) => true);
Function(String) get changeEmail => _email.sink.add;
Function(String) get changePassword => _password.sink.add;
submit() {
final validEmail = _email.value;
final validPassword = _password.value;
print('$validEmail, $validPassword');
dispose() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment