.shareValue()
doesn't exist anymore
.seeded()
factory constructor to the codemod
ValueStream
:-/
newStream = old.map(mapping).shareValue(mapping);
old.add('foo');
newStream.value == 'foo'; // That's not the case
.value
properly
EmailChanged
and PasswordChanged
events)
final debounced = events
.where((event) => event is! FormSubmitted)
.debounceTime(const Duration(milliseconds: 300));
FormSubmitted
event like this:
return events
.where((event) => event is FormSubmitted)
.mergeWith([debounced])
EmailChanged
and PasswordChanged
events could be triggered, being debounced, and then the FormSubmitted
event could arrive, and be handled before the change events are being handled
final onEmail = PublishSubject<String>(),
onPassword = PublishSubject<String>();
final onSubmit = PublishSubject<bool>();
final email = onEmail.debounceTime(const Duration(seconds: 1)),
password = onPassword.debounceTime(const Duration(seconds: 1));
bool Function(String) validateEmail, validatePassword;
final onSyncInput = Rx.merge([onEmail, onPassword]);
final onValid = Rx.combineLatest2(email.map(validateEmail),
password.map(validatePassword), (e, p) => e && p);
onSyncInput
.switchMap((_) => onValid)
.switchMap((canSubmit) => canSubmit ? onSubmit : Stream.value(false));