Closed MrCsabaToth closed 1 month ago
The tersest fix is adding an extra .toSet()
at https://github.com/csdcorp/speech_to_text/blob/1a40e483bfc30f4be9e9f542a8d0b823284b438a/speech_to_text/lib/speech_to_text.dart#L571 like so: var filteredLocales = locales.toSet()
One downside of this approach, that the toSet may disturb the original order of items, so maybe an extra ordering needed. If the deduplication is done at the application level (instead of the plugin), then objects need to be compared, more code is needed.
Yes, duplicates should be removed by the plugin, I'll have a look at that.
I can't reproduce this and can't see how it could happen given the de-duplication that happens in the Android implementation. However, it's pretty simple to add another layer into the plugin so I'll do that for the next release.
7.0.0-beta.2 is in pub.dev now with this change.
I also was not able to reproduce it with most of my devices (phones and FAWs), only one did that.
Now available in 7.0.0 on pub.dev
I'm fiddling with the example to debug #541. The example crashes when I press initialization because it tries to fill the selector for languages and I get:
The reason for this is because the
call in the plugin returns duplicates. In my case:
As we can see the "en_US:English (United States)" is duplicated. I'm not 100% sure if this meant to be handled in the plugin, but if not, then at least it should be handled in the example to deduplicate that array.