3
3
// found in the LICENSE file.
4
4
5
5
import 'dart:async' ;
6
- import 'dart:js_interop' ;
7
- // The analyzer currently thinks `js_interop_unsafe` is unused, but it is used
8
- // for `JSObject.[]=`.
9
- // ignore: unused_import
10
- import 'dart:js_interop_unsafe' ;
6
+ import 'dart:html' as html;
7
+ import 'dart:js_util' as js_util;
11
8
import 'dart:math' as math;
12
9
import 'dart:ui' ;
13
10
@@ -18,7 +15,6 @@ import 'package:flutter/scheduler.dart';
18
15
import 'package:flutter/services.dart' ;
19
16
import 'package:flutter/widgets.dart' ;
20
17
import 'package:meta/meta.dart' ;
21
- import 'package:web/web.dart' as web;
22
18
23
19
/// The default number of samples from warm-up iterations.
24
20
///
@@ -1257,7 +1253,7 @@ void startMeasureFrame(Profile profile) {
1257
1253
1258
1254
if (! profile.isWarmingUp) {
1259
1255
// Tell the browser to mark the beginning of the frame.
1260
- web .window.performance.mark ('measured_frame_start#$_currentFrameNumber ' .toJS );
1256
+ html .window.performance.mark ('measured_frame_start#$_currentFrameNumber ' );
1261
1257
1262
1258
_isMeasuringFrame = true ;
1263
1259
}
@@ -1280,11 +1276,11 @@ void endMeasureFrame() {
1280
1276
1281
1277
if (_isMeasuringFrame) {
1282
1278
// Tell the browser to mark the end of the frame, and measure the duration.
1283
- web .window.performance.mark ('measured_frame_end#$_currentFrameNumber ' .toJS );
1284
- web .window.performance.measure (
1285
- 'measured_frame' .toJS ,
1286
- 'measured_frame_start#$_currentFrameNumber ' .toJS ,
1287
- 'measured_frame_end#$_currentFrameNumber ' .toJS ,
1279
+ html .window.performance.mark ('measured_frame_end#$_currentFrameNumber ' );
1280
+ html .window.performance.measure (
1281
+ 'measured_frame' ,
1282
+ 'measured_frame_start#$_currentFrameNumber ' ,
1283
+ 'measured_frame_end#$_currentFrameNumber ' ,
1288
1284
);
1289
1285
1290
1286
// Increment the current frame number.
@@ -1314,10 +1310,7 @@ void registerEngineBenchmarkValueListener(String name, EngineBenchmarkValueListe
1314
1310
1315
1311
if (_engineBenchmarkListeners.isEmpty) {
1316
1312
// The first listener is being registered. Register the global listener.
1317
- web.window['_flutter_internal_on_benchmark' .toJS] =
1318
- // Upcast to [Object] to export.
1319
- // ignore: unnecessary_cast
1320
- (_dispatchEngineBenchmarkValue as Object ).toJS;
1313
+ js_util.setProperty (html.window, '_flutter_internal_on_benchmark' , _dispatchEngineBenchmarkValue);
1321
1314
}
1322
1315
1323
1316
_engineBenchmarkListeners[name] = listener;
@@ -1328,7 +1321,7 @@ void stopListeningToEngineBenchmarkValues(String name) {
1328
1321
_engineBenchmarkListeners.remove (name);
1329
1322
if (_engineBenchmarkListeners.isEmpty) {
1330
1323
// The last listener unregistered. Remove the global listener.
1331
- web. window[ '_flutter_internal_on_benchmark' .toJS] = null ;
1324
+ js_util. setProperty (html. window, '_flutter_internal_on_benchmark' , null ) ;
1332
1325
}
1333
1326
}
1334
1327
0 commit comments