registerWith static method
Implementation
static void registerWith(Registrar registrar) {
FlutterDropzonePlatform.instance = FlutterDropzonePlugin();
_isReady = _readyCompleter.future;
void readyHandler() {
if (!_readyCompleter.isCompleted) _readyCompleter.complete(true);
}
_flutterDropzoneWebReadyEvent.forTarget(web.window).listen((event) {
readyHandler();
});
// ignore: undefined_prefixed_name
ui.platformViewRegistry.registerViewFactory(
'io.flutter.plugins.flutter_dropzone/dropzone', (viewId) {
final view = _views[viewId] = FlutterDropzoneView(viewId);
return view.container;
});
// ignore: undefined_prefixed_name
final scriptUrl = ui.assetManager.getAssetUrl(
'packages/flutter_dropzone_web/assets/flutter_dropzone.js',
);
web.document.body!.append(web.HTMLScriptElement()
..src = scriptUrl
..type = 'application/javascript'
..defer = true);
}