csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
372 stars 231 forks source link

feat: add support to wasm in web platform #544

Closed yeikel16 closed 1 month ago

yeikel16 commented 1 month ago

Use the web package in web platform to allow wasm compilation.

Fix #523

Run:

flutter run -d chrome --release --wasm

Output:

Captura de pantalla 2024-08-07 a la(s) 2 31 13 p m
yeikel16 commented 1 month ago

Do you know if the WASM support is the same as the previous JS support, all the same browsers would be supported using WASM?

Yes is the same API, but the decision to compile using --wasm is made by the developer.

To support compilation to Wasm, Dart has shifted how it enables interop with browser and JavaScript APIs. This shift prevents Dart code that uses dart:html or package:js from compiling to Wasm.

Instead, Dart now provides new, lightweight interop solutions built around static JS interop:

package:web, which replaces dart:html (and other web libraries) dart:js_interop, which replaces package:js and dart:js

See some docs