Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Steven Spiel
2021-08-09 15:13:40 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2021-08-09 15:13:40 -0400
Commit
721344c108899f78750b4e76955c4524657c37a1
721344c1
1 parent
353236e4
Allow listening to Rx with an initial value
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
lib/get_rx/src/rx_types/rx_core/rx_impl.dart
lib/get_rx/src/rx_types/rx_core/rx_impl.dart
View file @
721344c
...
...
@@ -111,6 +111,24 @@ mixin RxObjectMixin<T> on NotifyManager<T> {
Stream
<
T
>
get
stream
=>
subject
.
stream
;
/// Returns a [StreamSubscription] similar to [listen], but with the
/// added benefit that it primes the stream with the current [value], rather
/// than waiting for the next [value]. This should not be called in [onInit]
/// or anywhere else during the build process.
StreamSubscription
<
T
>
listenAndPump
(
void
Function
(
T
event
)
onData
,
{
Function
?
onError
,
void
Function
()?
onDone
,
bool
?
cancelOnError
})
{
final
subscription
=
listen
(
onData
,
onError:
onError
,
onDone:
onDone
,
cancelOnError:
cancelOnError
,
);
subject
.
add
(
value
);
return
subscription
;
}
/// Binds an existing `Stream<T>` to this Rx<T> to keep the values in sync.
/// You can bind multiple sources to update the value.
/// Closing the subscription will happen automatically when the observer
...
...
Please
register
or
login
to post a comment