QrcodeFlutterWeb constructor

QrcodeFlutterWeb()

Constructs a QrcodeFlutterWeb

Implementation

QrcodeFlutterWeb() {
  ui.platformViewRegistry.registerViewFactory(
      _viewType,
      (int viewId) => html.DivElement()
        ..style.width = '100%'
        ..style.height = '100%'
        ..id = _viewType);
  html.document.body!.append(html.ScriptElement()
    ..src =
        'assets/packages/qrcode_flutter/assets/html5-qrcode.min.js' // ignore: unsafe_html
    ..type = 'application/javascript');
  html.document.body!.append(html.ScriptElement()
    ..src =
        'assets/packages/qrcode_flutter/assets/qrcode_flutter_web.js' // ignore: unsafe_html
    ..type = 'application/javascript');
  js_util.setProperty(html.window, "onCapture", js.allowInterop((args) {
    _capture?.call(args);
  }));
}