I am using Riverpod StreamProvider to create a stream.
Within the StreamProvider, is there any way to read the previous value supplied by this same StreamProvider?
No. You'll need to use a Stream filter like from the package:async pub package, or create a custom function that uses await for (e in aStream)
to process elements as they arrive, caching the previous element in a local variable.
Edit: on second thought, you could return a stream generated by an async *
function as the stream in your StreamProvider, which does the same thing as I just described with some input stream.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.