Open donpaul120 opened 3 years ago
I'm sorry guys!!! After sharing my problem i found out the embarrassing issue!!!!
Stream<bool> get isValid => Rx.combineLatest([usernameStream, passwordStream], (values) {
print(values);
return (values.elementAt(0) as String).isNotEmpty;
});
get
returns a new combined stream each time it's called! don't know why it works when the keyboard is hidden though..
You should store Stream
in a field and can use shareValueSeed(...)
to provide a value for StreamBuilder
You should store
Stream
in a field and can useshareValueSeed(...)
to provide a value forStreamBuilder
Thank you!... Please can you point me to the documentation of shareValueSeed
, i googled it and can't seem to find anything.
You should store
Stream
in a field and can useshareValueSeed(...)
to provide a value forStreamBuilder
Thank you!... Please can you point me to the documentation of
shareValueSeed
, i googled it and can't seem to find anything.
Just a typo 😃 I mean, shareValueSeeded(...)
: https://pub.dev/documentation/rxdart/latest/rx/ConnectableStreamExtensions/shareValueSeeded.html
class ProfileForm {
final stream = Rx.combineLatest(...).shareValueSeeded(false);
final subscription = stream.listen(null); // keep stream alive
void dispose() => subscription.cancel();
}
StreamBuilder<bool>(
stream: form.stream,
initialData: form.stream.requireValue, // or stream.value,
builder: ...
);
@hoc081098 Cool, Thanks... I will try this out.
This be the most weird thing to debug... as i'm currently new to flutter
The input fields works fine, that's username and password reacts well, however when the keyboard is up, the callback in
combineLatest
isn't trigger. i use cmd + K to open up the keyboard in ios simulator.The idea is to validate both the username and password and that should determine if the button should be enabled or disabled.
I tried
StreamGroup.merge([])
this works fine with keyboard visible or hidden, but the issue with stream group is i cannot access the typed value emitted.I noticed that when the keyboard is up, the connectionState is always waiting, i'm quite getting my hands around flutter coming from android native (observables,livedata,flow etc) so i really don't know much here.
I'm using: async: ^2.5.0 rxdart: ^0.26.0