anarchuser / mic_stream

Flutter plugin to get an infinite audio stream from the microphone
https://pub.dev/packages/mic_stream
GNU General Public License v3.0
100 stars 68 forks source link

[suggestion] feat: Improve API #65

Closed mirland closed 1 year ago

mirland commented 1 year ago

This is a suggestion of https://github.com/anarchuser/mic_stream/issues/64

Description

When the stream subscription is done, the mic stream is initializated and then it's returned

anarchuser commented 1 year ago

I'll give it a look. I have to be careful with any API changes, though

mirland commented 1 year ago

Yes, I know that every API change is important to review. However, mixing Futures with Stream is not a good practice (at least is not common).

An alternative to my solution could be having two methods, an init() (that returns a Future) and another to get the audio stream.

Again, both are suggestions!

anarchuser commented 1 year ago

well, I didn't write this myself, but I don't have the time to keep up with Flutter's fast-paced trends either. In the end, what matters is that the initialisation doesn't block and that errors are propagated appropriately. As long as this is satisfied, a simpler API is definitely better. Conceptually, merging a Future into a Stream should go seamlessly. I'll get around this by the end of the week, hopefully