stream_transform icon indicating copy to clipboard operation
stream_transform copied to clipboard

Make transformToHandlers public

Open kanapin opened this issue 4 years ago • 2 comments

Hello folks,

Currently transformFromHandlers isn't exported in lib/stream_transform.dart. Is it possible to expose it?

It's better than the standard fromHandlers transformer in the sense that it allows relying on a common state for broadcast streams since callbacks are called once per event only.

kanapin avatar Feb 09 '21 22:02 kanapin

cc @lrhn for thoughts.

The utility is:

https://github.com/dart-lang/stream_transform/blob/053711699fe0163c8106ea544729f5058e610ff3/lib/src/from_handlers.dart#L7-L16

I can see value in exposing this. If we decide we do want to expose it we should consider the naming (I wasn't careful about that as an internal detail), as well as wether an extension method is the right API (I think it is).

natebosch avatar Feb 10 '21 21:02 natebosch

It seems useful, so sure, why not.

Naming is hard.... let's go shopping. All the good names are taken! 😁

It should be named something with transform. Maybe just transformEvents. It doesn't transform the stream into a separate stream, but the events into different events (which is potatoe/potatoh really, but might make sense to the user anyway). It also matches, to me, with that each event is only transformed once,

lrhn avatar Feb 12 '21 15:02 lrhn