[element_embedding_demo] migrate to dart:js_interop (#2231)

pull/2234/head
Kevin Moore 9 months ago committed by GitHub
parent 17eb46212a
commit 37e149d8a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,10 +1,8 @@
// ignore_for_file: avoid_web_libraries_in_flutter
import 'dart:async';
import 'dart:js_interop' as js;
import 'dart:js_interop_unsafe' as js_util;
import 'package:flutter/material.dart';
import 'package:js/js.dart' as js;
import 'package:js/js_util.dart' as js_util;
void main() {
runApp(const MyApp());
@ -28,9 +26,9 @@ class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
final export = js_util.createDartExport(this);
js_util.setProperty(js_util.globalThis, '_appState', export);
js_util.callMethod<void>(js_util.globalThis, '_stateSet', []);
final export = js.createJSInteropWrapper(this);
js.globalContext['_appState'] = export;
js.globalContext.callMethod('_stateSet'.toJS);
}
@override

@ -10,7 +10,6 @@ dependencies:
cupertino_icons: ^1.0.2
flutter:
sdk: flutter
js: ^0.7.0
dev_dependencies:
flutter_test:

Loading…
Cancel
Save