BleScanCoroutines icon indicating copy to clipboard operation
BleScanCoroutines copied to clipboard

Using `flow` vs `channel` for scan results

Open gautamjain opened this issue 6 years ago • 1 comments

Hi Louis,

The scanChannel extension function currently returns a Channel. Do you think a Flow might be more suitable here?

I'm new to channels/flows/coroutines, so my understanding may not be correct. A Flow would allow more flexibility in when scanning should actually start - e.g. only after the user calls collect.

Current API works fine for my needs, but I was curious about your thoughts.

Thanks.

gautamjain avatar May 17 '19 19:05 gautamjain

Hi Gautam, yes, a Flow should work too, using flowViaChannel. Did you try it in your code with devices to scan?

LouisCAD avatar May 18 '19 21:05 LouisCAD