Closed mirland closed 1 year ago
Thank you for your suggestion.
It used to return just a Stream<Uint8List>
, and this was obviously the cleaner interface.
Setting up the internal stream initially may take some time though. And thus, in order to allow seamless integration into asynchronous applications, a Future is returned instead. In fact, in order to apply your suggestions, all I'd do is block the function call until the Future resolves - which goes against the concept of asynchronous programming entirely.
In case your only interested in android applications: you can use an older version which still uses the old interface. The Future is a result of iOS and MacOS support integration.
But you can combine streams, so I'd use a Stream.fromFuture(permissionStatus)
and then I'd combine the mic stream with a asyncExpand
.
Let me submit a pr, we can discuss the implementation
preliminary implementation published as 0.7.0-dev
Hi, thanks for the plugin, I have a API suggestion
Right now
MicStream.microphone()
returns aFuture<Stream<Uint8List>?>
. However, it's strange and also I think it's not needed to return a Future, it should return just aStream<Uint8List>
(not nullable)