fluttercommunity/rx_command

Please explain difference between emitLastResult and emitsLastValueToNewSubscriptions

fedotxxl opened this issue · 5 comments

Can you explain the difference and add it to the description?

When You run same command second time and _emitLastResult is set to true last result of commend will be emited to the result stream immediatly after start

On the other hand emitsLastValueToNewSubscriptions decides which type of Subject will be used for result stream
true BehaviorSubject - Subject with memory of last result
In practice if You have finished execution of command and after that You will subscribe new listener last result will be provided to that listener

Excatly on point @TomMannson

Sorry... Still don't get the difference. Can you provide a very simple example to display the difference between these properties?

When You run same command second time and _emitLastResult is set to true last result of commend will be emited to the result stream immediatly after start

This is not clear... Isn't it the same as second one (emitsLastValueToNewSubscriptions / BehaviorSubject)

In practice if You have finished execution of command and after that You will subscribe new listener last result will be provided to that listener

Ok, got it

So emitLastResult effects when you call the command multiple times and emitsLastValueToNewSubscriptions effects what happens when a new subsriber is added to the command if it already has run before.

ok, got it. Thank you