File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
example/lib/04.performance
lib/src/code_field/js_workarounds Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 55
66// ignore_for_file: avoid_print
77
8- import 'dart:js' as js; // ignore: avoid_web_libraries_in_flutter
8+ import 'dart:js_interop' as js;
9+ import 'dart:js_interop_unsafe' as js_util;
10+
911import 'package:flutter/material.dart' ;
1012import 'package:flutter_code_editor/flutter_code_editor.dart' ;
1113import 'package:flutter_highlight/themes/vs2015.dart' ;
@@ -56,7 +58,8 @@ final fieldFactories = <String, FieldFactory>{
5658 ),
5759};
5860
59- final renderer = js.context['flutterCanvasKit' ] == null ? 'HTML' : 'CanvasKit' ;
61+ final renderer =
62+ js.globalContext['flutterCanvasKit' ] == null ? 'HTML' : 'CanvasKit' ;
6063
6164void main () {
6265 runApp (CodeEditor ());
Original file line number Diff line number Diff line change 11// ignore: avoid_web_libraries_in_flutter
2- import 'dart:js' as js;
2+ import 'dart:js_interop' as js;
3+ import 'dart:js_interop_unsafe' as js_util;
34
45//=========================== Disable Spellcheck ===========================
56
@@ -21,7 +22,10 @@ bool _isTimerSet = false;
2122
2223void disableSpellCheck () {
2324 if (! _isTimerSet) {
24- js.context.callMethod ('eval' , [_jsSetDisableSpellCheckTimer]);
25+ js.globalContext.callMethod (
26+ 'eval' .toJS,
27+ _jsSetDisableSpellCheckTimer.toJS,
28+ );
2529 _isTimerSet = true ;
2630 }
2731}
@@ -39,5 +43,5 @@ const _jsDisableBuiltinSearch = '''
3943''' ;
4044
4145void disableBuiltInSearch () {
42- js.context .callMethod ('eval' , [ _jsDisableBuiltinSearch] );
46+ js.globalContext .callMethod ('eval' .toJS, _jsDisableBuiltinSearch.toJS );
4347}
You can’t perform that action at this time.
0 commit comments