Injecting data transforms into streams
A rather common scenario is the need to manipulate and transform data emitted from a stream before it gets to its final destination.
This is extremely useful when you want to filter data based on any type of condition, validate it, modify it before showing it to your users, or process it to generate some new output.
Examples include converting a number into a string, making a calculation, or omitting data repetitions.
In this recipe, you will inject StreamTransformers
into Streams
in order to map and filter data.
Getting ready
In order to follow along with this recipe, you should have completed the code in the previous recipe, Using stream controllers and sinks.
How to do it...
For this recipe, you will edit the random number on the screen, leveraging a StreamTransformer
, starting from the code that you completed in the previous recipe, Using stream controllers and sinks:
- At the top of the
_StreamHomePageState...