runs complex benchmark using `dart run`
diff --git a/engine/lib/src/hooks.dart b/engine/lib/src/hooks.dart
index 4cafee6..a27fad4 100644
--- a/engine/lib/src/hooks.dart
+++ b/engine/lib/src/hooks.dart
@@ -10,6 +10,7 @@
// ignore: unused_element
void _updateWindowMetrics(
+ bool isInitializing,
Object id,
double devicePixelRatio,
double width,
@@ -32,6 +33,7 @@
List<int> displayFeaturesState,
) {
PlatformDispatcher.instance._updateWindowMetrics(
+ isInitializing,
id,
devicePixelRatio,
width,
diff --git a/engine/lib/src/painting.dart b/engine/lib/src/painting.dart
index 519d4f1..562cf19 100644
--- a/engine/lib/src/painting.dart
+++ b/engine/lib/src/painting.dart
@@ -2564,8 +2564,8 @@
return Image._(_Image._(width, height));
}
- void dispose() { throw UnimplementedError(); }
- int get approximateBytesUsed { throw UnimplementedError(); }
+ void dispose() { }
+ int get approximateBytesUsed { return 100000; }
}
class PictureRecorder {
diff --git a/engine/lib/src/platform_dispatcher.dart b/engine/lib/src/platform_dispatcher.dart
index ddc5490..305c704 100644
--- a/engine/lib/src/platform_dispatcher.dart
+++ b/engine/lib/src/platform_dispatcher.dart
@@ -158,6 +158,7 @@
//
// Updates the metrics of the window with the given id.
void _updateWindowMetrics(
+ bool isInitializing,
Object id,
double devicePixelRatio,
double width,
@@ -223,7 +224,9 @@
devicePixelRatio: devicePixelRatio,
),
);
- _invoke(onMetricsChanged, _onMetricsChangedZone);
+ if (!isInitializing) {
+ _invoke(onMetricsChanged, _onMetricsChangedZone);
+ }
}
List<DisplayFeature> _decodeDisplayFeatures({
@@ -730,7 +733,7 @@
return _initialLifecycleState;
}
- late String _initialLifecycleState;
+ late String _initialLifecycleState = 'AppLifecycleState.resumed';
/// Tracks if the initial state has been accessed. Once accessed, we will stop
/// updating the [initialLifecycleState], as it is not the preferred way to
diff --git a/engine/lib/src/window.dart b/engine/lib/src/window.dart
index 47adc63..db46749 100644
--- a/engine/lib/src/window.dart
+++ b/engine/lib/src/window.dart
@@ -318,6 +318,7 @@
: super._(windowId, platformDispatcher) {
platformDispatcher._updateLifecycleState('resumed');
_updateWindowMetrics(
+ true, // isInitializing
0, // id
1.0, // devicePixelRatio
// 4k
diff --git a/framework/lib/src/foundation/bitfield.dart b/framework/lib/src/foundation/bitfield.dart
index 0110324..89c1705 100644
--- a/framework/lib/src/foundation/bitfield.dart
+++ b/framework/lib/src/foundation/bitfield.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import '_bitfield_io.dart'
- if (dart.library.js_util) '_bitfield_web.dart' as bitfield;
+ as bitfield;
/// The largest SMI value.
///
diff --git a/framework/lib/src/foundation/isolates.dart b/framework/lib/src/foundation/isolates.dart
index 31935c8..29c9991 100644
--- a/framework/lib/src/foundation/isolates.dart
+++ b/framework/lib/src/foundation/isolates.dart
@@ -5,7 +5,7 @@
import 'dart:async';
import '_isolates_io.dart'
- if (dart.library.js_util) '_isolates_web.dart' as isolates;
+ as isolates;
/// Signature for the callback passed to [compute].
///
diff --git a/framework/lib/src/foundation/platform.dart b/framework/lib/src/foundation/platform.dart
index c730c6a..5530066 100644
--- a/framework/lib/src/foundation/platform.dart
+++ b/framework/lib/src/foundation/platform.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import '_platform_io.dart'
- if (dart.library.js_util) '_platform_web.dart' as platform;
+ as platform;
/// The [TargetPlatform] that matches the platform on which the framework is
/// currently executing.
diff --git a/framework/lib/src/painting/image_provider.dart b/framework/lib/src/painting/image_provider.dart
index 98fdaf8..da46c3b 100644
--- a/framework/lib/src/painting/image_provider.dart
+++ b/framework/lib/src/painting/image_provider.dart
@@ -11,7 +11,7 @@
import 'package:flute/services.dart';
import '_network_image_io.dart'
- if (dart.library.js_util) '_network_image_web.dart' as network_image;
+ as network_image;
import 'binding.dart';
import 'image_cache.dart';
import 'image_stream.dart';
diff --git a/framework/lib/src/services/platform_channel.dart b/framework/lib/src/services/platform_channel.dart
index 053fc7b..d4456b0 100644
--- a/framework/lib/src/services/platform_channel.dart
+++ b/framework/lib/src/services/platform_channel.dart
@@ -8,7 +8,7 @@
import 'package:flute/foundation.dart';
import '_background_isolate_binary_messenger_io.dart'
- if (dart.library.js_util) '_background_isolate_binary_messenger_web.dart';
+ ;
import 'binary_messenger.dart';
import 'binding.dart';
@@ -17,7 +17,7 @@
import 'message_codecs.dart';
export '_background_isolate_binary_messenger_io.dart'
- if (dart.library.js_util) '_background_isolate_binary_messenger_web.dart';
+ ;
export 'binary_messenger.dart' show BinaryMessenger;
export 'binding.dart' show RootIsolateToken;
diff --git a/framework/lib/src/widgets/platform_selectable_region_context_menu.dart b/framework/lib/src/widgets/platform_selectable_region_context_menu.dart
index 2bd7e7c..e61c490 100644
--- a/framework/lib/src/widgets/platform_selectable_region_context_menu.dart
+++ b/framework/lib/src/widgets/platform_selectable_region_context_menu.dart
@@ -3,4 +3,4 @@
// found in the LICENSE file.
export '_platform_selectable_region_context_menu_io.dart'
-if (dart.library.js_util) '_platform_selectable_region_context_menu_web.dart';
+;
diff --git a/script/bin/sync.dart b/script/bin/sync.dart
index 1760053..7265918 100644
--- a/script/bin/sync.dart
+++ b/script/bin/sync.dart
@@ -47,6 +47,21 @@
source = source.replaceAll("'dart:ui'", "'package:engine/ui.dart'");
}
+ source = source.split('\n').map<String>((String line) {
+ final int indexOfConditionalImport = line.indexOf(r'if (dart.library');
+ if (indexOfConditionalImport == -1) {
+ return line;
+ }
+
+ final int indexOfAs = line.indexOf(r' as ');
+
+ if (indexOfAs != -1) {
+ return '${line.substring(0, indexOfConditionalImport)} ${line.substring(indexOfAs)}';
+ }
+
+ return '${line.substring(0, indexOfConditionalImport)};';
+ }).join('\n');
+
bool skip = false;
if (destFile.existsSync()) {
final String currentSrc = destFile.readAsStringSync();