bloc icon indicating copy to clipboard operation
bloc copied to clipboard

docs: not enough information on event transformers

Open vogdb opened this issue 2 years ago • 0 comments

Hi! It's not clear from the API docs how to write a custom transformer on your own. There are some examples in tutorials like Infinite List or in the migration guide. However it's not clear how to write a transformer without bloc_concurrency package.

Let's consider a typical example from the docs:

EventTransformer<E> throttleDroppable<E>(Duration duration) {
  return (events, mapper) {
    return droppable<E>().call(events.throttle(duration), mapper);
  };
}
  • Why one can't just use events.throttle(duration) directly like this?
EventTransformer<E> throttleDroppable<E>(Duration duration) {
  return (events, mapper) {
    return events.throttle(duration);
  };
}
  • What's the purpose of mapper?

Where can I find answers to these questions? Could've I missed some docs? Currently I've read all https://bloclibrary.dev.

vogdb avatar Sep 02 '22 08:09 vogdb