File tree 2 files changed +12
-5
lines changed
example/lib/04.performance
lib/src/code_field/js_workarounds
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 5
5
6
6
// ignore_for_file: avoid_print
7
7
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
+
9
11
import 'package:flutter/material.dart' ;
10
12
import 'package:flutter_code_editor/flutter_code_editor.dart' ;
11
13
import 'package:flutter_highlight/themes/vs2015.dart' ;
@@ -56,7 +58,8 @@ final fieldFactories = <String, FieldFactory>{
56
58
),
57
59
};
58
60
59
- final renderer = js.context['flutterCanvasKit' ] == null ? 'HTML' : 'CanvasKit' ;
61
+ final renderer =
62
+ js.globalContext['flutterCanvasKit' ] == null ? 'HTML' : 'CanvasKit' ;
60
63
61
64
void main () {
62
65
runApp (CodeEditor ());
Original file line number Diff line number Diff line change 1
1
// 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;
3
4
4
5
//=========================== Disable Spellcheck ===========================
5
6
@@ -21,7 +22,10 @@ bool _isTimerSet = false;
21
22
22
23
void disableSpellCheck () {
23
24
if (! _isTimerSet) {
24
- js.context.callMethod ('eval' , [_jsSetDisableSpellCheckTimer]);
25
+ js.globalContext.callMethod (
26
+ 'eval' .toJS,
27
+ _jsSetDisableSpellCheckTimer.toJS,
28
+ );
25
29
_isTimerSet = true ;
26
30
}
27
31
}
@@ -39,5 +43,5 @@ const _jsDisableBuiltinSearch = '''
39
43
''' ;
40
44
41
45
void disableBuiltInSearch () {
42
- js.context .callMethod ('eval' , [ _jsDisableBuiltinSearch] );
46
+ js.globalContext .callMethod ('eval' .toJS, _jsDisableBuiltinSearch.toJS );
43
47
}
You can’t perform that action at this time.
0 commit comments