loadScript function
Implementation
Future<void> loadScript() async {
if (_scriptLoaderCompleter != null) {
return _scriptLoaderCompleter!.future;
}
_scriptLoaderCompleter = Completer();
final assetManager = AssetManager();
final script = web.HTMLScriptElement();
script.src = assetManager
.getAssetUrl('packages/flutter_avif_web/web/avif_encoder.loader.js');
web.document.head!.append(script);
await script.onLoad.first;
final initBindgen = _initBindgen(assetManager
.getAssetUrl('packages/flutter_avif_web/web/avif_encoder.worker.js').toJS).toDart;
await initBindgen;
_scriptLoaderCompleter!.complete();
}