What's the best way to handle actions that trigger transformations in
- Send a request once the user taps a button.
- Request a new page in a list.
In other Reactive implementations like
RxSwift, you can define the type
Observable<Void> and listen to new events to start the transformations.
You can define a Observable in
RxDart but then you are forced to add something in the subject like
subject.add(0) which is confusing. It would be cool to use
subject.add(()) but this is not possible.
The first idea that comes to my mind is to create a new type like
Empty or more specifically for the proposed scenarios
Then I could do something like this:
PublishSubject<Action> action = PublishSubject<Action>(); action.withLatestFrom(...) .map(....) // Apply the desired transformations .... ....; action.add(Action.create()); action.add(Action.create());
Am I reinventing the wheel?
Is there a simpler approach to handle elegantly what I am proposing here?