From fe80dff37bf7cefb5a7491e2ca7e0179b6a3dcb3 Mon Sep 17 00:00:00 2001 From: Yegor Date: Thu, 4 Jun 2020 14:31:08 -0700 Subject: [PATCH] null annotate window.dart (#18789) --- lib/ui/window.dart | 245 ++++++------ lib/web_ui/lib/src/engine.dart | 2 +- lib/web_ui/lib/src/engine/window.dart | 22 +- lib/web_ui/lib/src/ui/test_embedding.dart | 2 +- lib/web_ui/lib/src/ui/window.dart | 456 +++++++++------------- 5 files changed, 320 insertions(+), 407 deletions(-) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 084fe4d53e1..aae5666d0b6 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -9,7 +9,7 @@ part of dart.ui; typedef VoidCallback = void Function(); /// Signature for [Window.onBeginFrame]. -typedef FrameCallback = void Function(Duration duration); +typedef FrameCallback = void Function(Duration/*!*/ duration); /// Signature for [Window.onReportTimings]. /// @@ -23,25 +23,25 @@ typedef FrameCallback = void Function(Duration duration); /// even if there are no later frames to batch. The timing of the first frame /// will be sent immediately without batching. /// {@endtemplate} -typedef TimingsCallback = void Function(List timings); +typedef TimingsCallback = void Function(List/*!*/ timings); /// Signature for [Window.onPointerDataPacket]. -typedef PointerDataPacketCallback = void Function(PointerDataPacket packet); +typedef PointerDataPacketCallback = void Function(PointerDataPacket/*!*/ packet); /// Signature for [Window.onSemanticsAction]. -typedef SemanticsActionCallback = void Function(int id, SemanticsAction action, ByteData args); +typedef SemanticsActionCallback = void Function(int/*!*/ id, SemanticsAction/*!*/ action, ByteData/*?*/ args); /// Signature for responses to platform messages. /// /// Used as a parameter to [Window.sendPlatformMessage] and /// [Window.onPlatformMessage]. -typedef PlatformMessageResponseCallback = void Function(ByteData data); +typedef PlatformMessageResponseCallback = void Function(ByteData/*?*/ data); /// Signature for [Window.onPlatformMessage]. -typedef PlatformMessageCallback = void Function(String name, ByteData data, PlatformMessageResponseCallback callback); +typedef PlatformMessageCallback = void Function(String/*!*/ name, ByteData/*?*/ data, PlatformMessageResponseCallback/*?*/ callback); // Signature for _setNeedsReportTimings. -typedef _SetNeedsReportTimingsFunc = void Function(bool value); +typedef _SetNeedsReportTimingsFunc = void Function(bool/*!*/ value); /// Various important time points in the lifetime of a frame. /// @@ -89,14 +89,14 @@ class FrameTiming { /// /// This constructor is usually only called by the Flutter engine, or a test. /// To get the [FrameTiming] of your app, see [Window.onReportTimings]. - FrameTiming(List timestamps) + FrameTiming(List/*!*/ timestamps) : assert(timestamps.length == FramePhase.values.length), _timestamps = timestamps; /// This is a raw timestamp in microseconds from some epoch. The epoch in all /// [FrameTiming] is the same, but it may not match [DateTime]'s epoch. - int timestampInMicroseconds(FramePhase phase) => _timestamps[phase.index]; + int/*!*/ timestampInMicroseconds(FramePhase/*!*/ phase) => _timestamps[phase.index]; - Duration _rawDuration(FramePhase phase) => Duration(microseconds: _timestamps[phase.index]); + Duration/*!*/ _rawDuration(FramePhase/*!*/ phase) => Duration(microseconds: _timestamps[phase.index]); /// The duration to build the frame on the UI thread. /// @@ -113,13 +113,13 @@ class FrameTiming { /// {@template dart.ui.FrameTiming.fps_milliseconds} /// That's about 16ms for 60fps, and 8ms for 120fps. /// {@endtemplate} - Duration get buildDuration => _rawDuration(FramePhase.buildFinish) - _rawDuration(FramePhase.buildStart); + Duration/*!*/ get buildDuration => _rawDuration(FramePhase.buildFinish) - _rawDuration(FramePhase.buildStart); /// The duration to rasterize the frame on the raster thread. /// /// {@macro dart.ui.FrameTiming.fps_smoothness_milliseconds} /// {@macro dart.ui.FrameTiming.fps_milliseconds} - Duration get rasterDuration => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.rasterStart); + Duration/*!*/ get rasterDuration => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.rasterStart); /// The timespan between build start and raster finish. /// @@ -128,9 +128,9 @@ class FrameTiming { /// {@macro dart.ui.FrameTiming.fps_milliseconds} /// /// See also [buildDuration] and [rasterDuration]. - Duration get totalSpan => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.buildStart); + Duration/*!*/ get totalSpan => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.buildStart); - final List _timestamps; // in microseconds + final List/*!*/ _timestamps; // in microseconds String _formatMS(Duration duration) => '${duration.inMicroseconds * 0.001}ms'; @@ -209,16 +209,16 @@ class WindowPadding { const WindowPadding._({ this.left, this.top, this.right, this.bottom }); /// The distance from the left edge to the first unpadded pixel, in physical pixels. - final double left; + final double/*!*/ left; /// The distance from the top edge to the first unpadded pixel, in physical pixels. - final double top; + final double/*!*/ top; /// The distance from the right edge to the first unpadded pixel, in physical pixels. - final double right; + final double/*!*/ right; /// The distance from the bottom edge to the first unpadded pixel, in physical pixels. - final double bottom; + final double/*!*/ bottom; /// A window padding that has zeros for each edge. static const WindowPadding zero = WindowPadding._(left: 0.0, top: 0.0, right: 0.0, bottom: 0.0); @@ -303,9 +303,9 @@ class Locale { /// Validity is not checked by default, but some methods may throw away /// invalid data. const Locale.fromSubtags({ - String languageCode = 'und', + String/*!*/ languageCode = 'und', this.scriptCode, - String countryCode, + String/*?*/ countryCode, }) : assert(languageCode != null), assert(languageCode != ''), _languageCode = languageCode, @@ -336,8 +336,8 @@ class Locale { /// /// * [Locale.fromSubtags], which describes the conventions for creating /// [Locale] objects. - String get languageCode => _deprecatedLanguageSubtagMap[_languageCode] ?? _languageCode; - final String _languageCode; + String/*!*/ get languageCode => _deprecatedLanguageSubtagMap[_languageCode] ?? _languageCode; + final String/*!*/ _languageCode; // This map is generated by //flutter/tools/gen_locale.dart // Mappings generated for language subtag registry as of 2019-02-27. @@ -434,7 +434,7 @@ class Locale { /// /// * [Locale.fromSubtags], which describes the conventions for creating /// [Locale] objects. - final String scriptCode; + final String/*?*/ scriptCode; /// The region subtag for the locale. /// @@ -455,8 +455,8 @@ class Locale { /// /// * [Locale.fromSubtags], which describes the conventions for creating /// [Locale] objects. - String get countryCode => _deprecatedRegionSubtagMap[_countryCode] ?? _countryCode; - final String _countryCode; + String/*?*/ get countryCode => _deprecatedRegionSubtagMap[_countryCode] ?? _countryCode; + final String/*?*/ _countryCode; // This map is generated by //flutter/tools/gen_locale.dart // Mappings generated for language subtag registry as of 2019-02-27. @@ -470,7 +470,7 @@ class Locale { }; @override - bool operator ==(dynamic other) { + bool/*!*/ operator ==(dynamic other) { if (identical(this, other)) return true; return other is Locale @@ -482,10 +482,10 @@ class Locale { } @override - int get hashCode => hashValues(languageCode, scriptCode, countryCode == '' ? null : countryCode); + int/*!*/ get hashCode => hashValues(languageCode, scriptCode, countryCode == '' ? null : countryCode); - static Locale _cachedLocale; - static String _cachedLocaleString; + static Locale/*?*/ _cachedLocale; + static String/*?*/ _cachedLocaleString; /// Returns a string representing the locale. /// @@ -507,9 +507,9 @@ class Locale { /// Some examples of such identifiers: "en", "es-419", "hi-Deva-IN" and /// "zh-Hans-CN". See http://www.unicode.org/reports/tr35/ for technical /// details. - String toLanguageTag() => _rawToString('-'); + String/*!*/ toLanguageTag() => _rawToString('-'); - String _rawToString(String separator) { + String/*!*/ _rawToString(String separator) { final StringBuffer out = StringBuffer(languageCode); if (scriptCode != null && scriptCode.isNotEmpty) out.write('$separator$scriptCode'); @@ -600,8 +600,8 @@ class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. - double get devicePixelRatio => _devicePixelRatio; - double _devicePixelRatio = 1.0; + double/*!*/ get devicePixelRatio => _devicePixelRatio; + double/*!*/ _devicePixelRatio = 1.0; /// The dimensions of the rectangle into which the application will be drawn, /// in physical pixels. @@ -620,8 +620,8 @@ class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. - Size get physicalSize => _physicalSize; - Size _physicalSize = Size.zero; + Size/*!*/ get physicalSize => _physicalSize; + Size/*!*/ _physicalSize = Size.zero; /// The physical depth is the maximum elevation that the Window allows. /// @@ -634,8 +634,8 @@ class Window { /// The default value is [double.maxFinite], which is used for platforms that /// do not specify a maximum elevation. This property is currently on expected /// to be set to a non-default value on Fuchsia. - double get physicalDepth => _physicalDepth; - double _physicalDepth = double.maxFinite; + double/*!*/ get physicalDepth => _physicalDepth; + double/*!*/ _physicalDepth = double.maxFinite; /// The number of physical pixels on each side of the display rectangle into /// which the application can render, but over which the operating system @@ -655,8 +655,8 @@ class Window { /// * [MediaQuery.of], a simpler mechanism for the same. /// * [Scaffold], which automatically applies the view insets in material /// design applications. - WindowPadding get viewInsets => _viewInsets; - WindowPadding _viewInsets = WindowPadding.zero; + WindowPadding/*!*/ get viewInsets => _viewInsets; + WindowPadding/*!*/ _viewInsets = WindowPadding.zero; /// The number of physical pixels on each side of the display rectangle into /// which the application can render, but which may be partially obscured by @@ -682,8 +682,8 @@ class Window { /// * [MediaQuery.of], a simpler mechanism for the same. /// * [Scaffold], which automatically applies the padding in material design /// applications. - WindowPadding get viewPadding => _viewPadding; - WindowPadding _viewPadding = WindowPadding.zero; + WindowPadding/*!*/ get viewPadding => _viewPadding; + WindowPadding/*!*/ _viewPadding = WindowPadding.zero; /// The number of physical pixels on each side of the display rectangle into /// which the application can render, but where the operating system will @@ -700,8 +700,8 @@ class Window { /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. /// * [MediaQuery.of], a simpler mechanism for the same. - WindowPadding get systemGestureInsets => _systemGestureInsets; - WindowPadding _systemGestureInsets = WindowPadding.zero; + WindowPadding/*!*/ get systemGestureInsets => _systemGestureInsets; + WindowPadding/*!*/ _systemGestureInsets = WindowPadding.zero; /// The number of physical pixels on each side of the display rectangle into /// which the application can render, but which may be partially obscured by @@ -730,8 +730,8 @@ class Window { /// * [MediaQuery.of], a simpler mechanism for the same. /// * [Scaffold], which automatically applies the padding in material design /// applications. - WindowPadding get padding => _padding; - WindowPadding _padding = WindowPadding.zero; + WindowPadding/*!*/ get padding => _padding; + WindowPadding/*!*/ _padding = WindowPadding.zero; /// A callback that is invoked whenever the [devicePixelRatio], /// [physicalSize], [padding], [viewInsets], or [systemGestureInsets] @@ -750,10 +750,10 @@ class Window { /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// register for notifications when this is called. /// * [MediaQuery.of], a simpler mechanism for the same. - VoidCallback get onMetricsChanged => _onMetricsChanged; - VoidCallback _onMetricsChanged; - Zone _onMetricsChangedZone; - set onMetricsChanged(VoidCallback callback) { + VoidCallback/*?*/ get onMetricsChanged => _onMetricsChanged; + VoidCallback/*?*/ _onMetricsChanged; + Zone/*!*/ _onMetricsChangedZone = Zone.root; + set onMetricsChanged(VoidCallback/*?*/ callback) { _onMetricsChanged = callback; _onMetricsChangedZone = Zone.current; } @@ -768,7 +768,7 @@ class Window { /// /// This is equivalent to `locales.first` and will provide an empty non-null locale /// if the [locales] list has not been set or is empty. - Locale get locale { + Locale/*?*/ get locale { if (_locales != null && _locales.isNotEmpty) { return _locales.first; } @@ -789,8 +789,8 @@ class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. - List get locales => _locales; - List _locales; + List/*?*/ get locales => _locales; + List/*?*/ _locales; /// The locale that the platform's native locale resolution system resolves to. /// @@ -802,8 +802,8 @@ class Window { /// in order to arrive at the most appropriate locale for the app. /// /// See [locales], which is the list of locales the user/device prefers. - Locale get platformResolvedLocale => _platformResolvedLocale; - Locale _platformResolvedLocale; + Locale/*?*/ get platformResolvedLocale => _platformResolvedLocale; + Locale/*?*/ _platformResolvedLocale; /// A callback that is invoked whenever [locale] changes value. /// @@ -814,9 +814,9 @@ class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this callback is invoked. - VoidCallback get onLocaleChanged => _onLocaleChanged; - VoidCallback _onLocaleChanged; - Zone _onLocaleChangedZone; + VoidCallback/*?*/ get onLocaleChanged => _onLocaleChanged; + VoidCallback/*?*/ _onLocaleChanged; + Zone/*!*/ _onLocaleChangedZone = Zone.root; set onLocaleChanged(VoidCallback callback) { _onLocaleChanged = callback; _onLocaleChangedZone = Zone.current; @@ -828,15 +828,15 @@ class Window { /// /// It is used to initialize [SchedulerBinding.lifecycleState] at startup /// with any buffered lifecycle state events. - String get initialLifecycleState { + String/*!*/ get initialLifecycleState { _initialLifecycleStateAccessed = true; return _initialLifecycleState; } - String _initialLifecycleState; + /*late*/ String/*!*/ _initialLifecycleState; /// Tracks if the initial state has been accessed. Once accessed, we /// will stop updating the [initialLifecycleState], as it is not the /// preferred way to access the state. - bool _initialLifecycleStateAccessed = false; + bool/*!*/ _initialLifecycleStateAccessed = false; /// The system-reported text scale. /// @@ -850,15 +850,15 @@ class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. - double get textScaleFactor => _textScaleFactor; - double _textScaleFactor = 1.0; + double/*!*/ get textScaleFactor => _textScaleFactor; + double/*!*/ _textScaleFactor = 1.0; /// The setting indicating whether time should always be shown in the 24-hour /// format. /// /// This option is used by [showTimePicker]. - bool get alwaysUse24HourFormat => _alwaysUse24HourFormat; - bool _alwaysUse24HourFormat = false; + bool/*!*/ get alwaysUse24HourFormat => _alwaysUse24HourFormat; + bool/*!*/ _alwaysUse24HourFormat = false; /// A callback that is invoked whenever [textScaleFactor] changes value. /// @@ -869,18 +869,18 @@ class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this callback is invoked. - VoidCallback get onTextScaleFactorChanged => _onTextScaleFactorChanged; - VoidCallback _onTextScaleFactorChanged; - Zone _onTextScaleFactorChangedZone; - set onTextScaleFactorChanged(VoidCallback callback) { + VoidCallback/*?*/ get onTextScaleFactorChanged => _onTextScaleFactorChanged; + VoidCallback/*?*/ _onTextScaleFactorChanged; + Zone/*!*/ _onTextScaleFactorChangedZone = Zone.root; + set onTextScaleFactorChanged(VoidCallback/*?*/ callback) { _onTextScaleFactorChanged = callback; _onTextScaleFactorChangedZone = Zone.current; } /// The setting indicating the current brightness mode of the host platform. /// If the platform has no preference, [platformBrightness] defaults to [Brightness.light]. - Brightness get platformBrightness => _platformBrightness; - Brightness _platformBrightness = Brightness.light; + Brightness/*!*/ get platformBrightness => _platformBrightness; + Brightness/*!*/ _platformBrightness = Brightness.light; /// A callback that is invoked whenever [platformBrightness] changes value. /// @@ -891,10 +891,10 @@ class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this callback is invoked. - VoidCallback get onPlatformBrightnessChanged => _onPlatformBrightnessChanged; - VoidCallback _onPlatformBrightnessChanged; - Zone _onPlatformBrightnessChangedZone; - set onPlatformBrightnessChanged(VoidCallback callback) { + VoidCallback/*?*/ get onPlatformBrightnessChanged => _onPlatformBrightnessChanged; + VoidCallback/*?*/ _onPlatformBrightnessChanged; + Zone/*!*/ _onPlatformBrightnessChangedZone = Zone.root; + set onPlatformBrightnessChanged(VoidCallback/*?*/ callback) { _onPlatformBrightnessChanged = callback; _onPlatformBrightnessChangedZone = Zone.current; } @@ -918,10 +918,10 @@ class Window { /// scheduling of frames. /// * [RendererBinding], the Flutter framework class which manages layout and /// painting. - FrameCallback get onBeginFrame => _onBeginFrame; - FrameCallback _onBeginFrame; - Zone _onBeginFrameZone; - set onBeginFrame(FrameCallback callback) { + FrameCallback/*?*/ get onBeginFrame => _onBeginFrame; + FrameCallback/*?*/ _onBeginFrame; + Zone/*!*/ _onBeginFrameZone = Zone.root; + set onBeginFrame(FrameCallback/*?*/ callback) { _onBeginFrame = callback; _onBeginFrameZone = Zone.current; } @@ -940,10 +940,10 @@ class Window { /// scheduling of frames. /// * [RendererBinding], the Flutter framework class which manages layout and /// painting. - VoidCallback get onDrawFrame => _onDrawFrame; - VoidCallback _onDrawFrame; - Zone _onDrawFrameZone; - set onDrawFrame(VoidCallback callback) { + VoidCallback/*?*/ get onDrawFrame => _onDrawFrame; + VoidCallback/*?*/ _onDrawFrame; + Zone/*!*/ _onDrawFrameZone = Zone.root; + set onDrawFrame(VoidCallback/*?*/ callback) { _onDrawFrame = callback; _onDrawFrameZone = Zone.current; } @@ -969,10 +969,10 @@ class Window { /// Flutter spends less than 0.1ms every 1 second to report the timings /// (measured on iPhone6S). The 0.1ms is about 0.6% of 16ms (frame budget for /// 60fps), or 0.01% CPU usage per second. - TimingsCallback get onReportTimings => _onReportTimings; - TimingsCallback _onReportTimings; - Zone _onReportTimingsZone; - set onReportTimings(TimingsCallback callback) { + TimingsCallback/*?*/ get onReportTimings => _onReportTimings; + TimingsCallback/*?*/ _onReportTimings; + Zone/*!*/ _onReportTimingsZone = Zone.root; + set onReportTimings(TimingsCallback/*?*/ callback) { if ((callback == null) != (_onReportTimings == null)) { _setNeedsReportTimings(callback != null); } @@ -980,7 +980,7 @@ class Window { _onReportTimingsZone = Zone.current; } - _SetNeedsReportTimingsFunc _setNeedsReportTimings; + /*late*/ _SetNeedsReportTimingsFunc/*!*/ _setNeedsReportTimings; void _nativeSetNeedsReportTimings(bool/*!*/ value) native 'Window_setNeedsReportTimings'; /// A callback that is invoked when pointer data is available. @@ -992,10 +992,10 @@ class Window { /// /// * [GestureBinding], the Flutter framework class which manages pointer /// events. - PointerDataPacketCallback get onPointerDataPacket => _onPointerDataPacket; - PointerDataPacketCallback _onPointerDataPacket; - Zone _onPointerDataPacketZone; - set onPointerDataPacket(PointerDataPacketCallback callback) { + PointerDataPacketCallback/*?*/ get onPointerDataPacket => _onPointerDataPacket; + PointerDataPacketCallback/*?*/ _onPointerDataPacket; + Zone/*!*/ _onPointerDataPacketZone = Zone.root; + set onPointerDataPacket(PointerDataPacketCallback/*?*/ callback) { _onPointerDataPacket = callback; _onPointerDataPacketZone = Zone.current; } @@ -1073,17 +1073,17 @@ class Window { /// /// The [onSemanticsEnabledChanged] callback is called whenever this value /// changes. - bool get semanticsEnabled => _semanticsEnabled; - bool _semanticsEnabled = false; + bool/*!*/ get semanticsEnabled => _semanticsEnabled; + bool/*!*/ _semanticsEnabled = false; /// A callback that is invoked when the value of [semanticsEnabled] changes. /// /// The framework invokes this callback in the same zone in which the /// callback was set. - VoidCallback get onSemanticsEnabledChanged => _onSemanticsEnabledChanged; - VoidCallback _onSemanticsEnabledChanged; - Zone _onSemanticsEnabledChangedZone; - set onSemanticsEnabledChanged(VoidCallback callback) { + VoidCallback/*?*/ get onSemanticsEnabledChanged => _onSemanticsEnabledChanged; + VoidCallback/*?*/ _onSemanticsEnabledChanged; + Zone/*!*/ _onSemanticsEnabledChangedZone = Zone.root; + set onSemanticsEnabledChanged(VoidCallback/*?*/ callback) { _onSemanticsEnabledChanged = callback; _onSemanticsEnabledChangedZone = Zone.current; } @@ -1096,26 +1096,27 @@ class Window { /// /// The framework invokes this callback in the same zone in which the /// callback was set. - SemanticsActionCallback get onSemanticsAction => _onSemanticsAction; - SemanticsActionCallback _onSemanticsAction; - Zone _onSemanticsActionZone; - set onSemanticsAction(SemanticsActionCallback callback) { + SemanticsActionCallback/*?*/ get onSemanticsAction => _onSemanticsAction; + SemanticsActionCallback/*?*/ _onSemanticsAction; + Zone/*!*/ _onSemanticsActionZone = Zone.root; + set onSemanticsAction(SemanticsActionCallback/*?*/ callback) { _onSemanticsAction = callback; _onSemanticsActionZone = Zone.current; } /// Additional accessibility features that may be enabled by the platform. - AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures; - AccessibilityFeatures _accessibilityFeatures; + AccessibilityFeatures/*!*/ get accessibilityFeatures => _accessibilityFeatures; + // The zero value matches the default value in `window_data.h`. + AccessibilityFeatures/*!*/ _accessibilityFeatures = const AccessibilityFeatures._(0); /// A callback that is invoked when the value of [accessibilityFeatures] changes. /// /// The framework invokes this callback in the same zone in which the /// callback was set. - VoidCallback get onAccessibilityFeaturesChanged => _onAccessibilityFeaturesChanged; - VoidCallback _onAccessibilityFeaturesChanged; - Zone _onAccessibilityFeaturesChangedZone; - set onAccessibilityFeaturesChanged(VoidCallback callback) { + VoidCallback/*?*/ get onAccessibilityFeaturesChanged => _onAccessibilityFeaturesChanged; + VoidCallback/*?*/ _onAccessibilityFeaturesChanged; + Zone/*!*/ _onAccessibilityFeaturesChangedZone = Zone.root; + set onAccessibilityFeaturesChanged(VoidCallback/*?*/ callback) { _onAccessibilityFeaturesChanged = callback; _onAccessibilityFeaturesChangedZone = Zone.current; } @@ -1173,10 +1174,10 @@ class Window { /// /// The framework invokes this callback in the same zone in which the /// callback was set. - PlatformMessageCallback get onPlatformMessage => _onPlatformMessage; - PlatformMessageCallback _onPlatformMessage; - Zone _onPlatformMessageZone; - set onPlatformMessage(PlatformMessageCallback callback) { + PlatformMessageCallback/*?*/ get onPlatformMessage => _onPlatformMessage; + PlatformMessageCallback/*?*/ _onPlatformMessage; + Zone/*!*/ _onPlatformMessageZone = Zone.root; + set onPlatformMessage(PlatformMessageCallback/*?*/ callback) { _onPlatformMessage = callback; _onPlatformMessageZone = Zone.current; } @@ -1231,38 +1232,38 @@ class AccessibilityFeatures { static const int _kHighContrastIndex = 1 << 5; // A bitfield which represents each enabled feature. - final int _index; + final int/*!*/ _index; /// Whether there is a running accessibility service which is changing the /// interaction model of the device. /// /// For example, TalkBack on Android and VoiceOver on iOS enable this flag. - bool get accessibleNavigation => _kAccessibleNavigation & _index != 0; + bool/*!*/ get accessibleNavigation => _kAccessibleNavigation & _index != 0; /// The platform is inverting the colors of the application. - bool get invertColors => _kInvertColorsIndex & _index != 0; + bool/*!*/ get invertColors => _kInvertColorsIndex & _index != 0; /// The platform is requesting that animations be disabled or simplified. - bool get disableAnimations => _kDisableAnimationsIndex & _index != 0; + bool/*!*/ get disableAnimations => _kDisableAnimationsIndex & _index != 0; /// The platform is requesting that text be rendered at a bold font weight. /// /// Only supported on iOS. - bool get boldText => _kBoldTextIndex & _index != 0; + bool/*!*/ get boldText => _kBoldTextIndex & _index != 0; /// The platform is requesting that certain animations be simplified and /// parallax effects removed. /// /// Only supported on iOS. - bool get reduceMotion => _kReduceMotionIndex & _index != 0; + bool/*!*/ get reduceMotion => _kReduceMotionIndex & _index != 0; /// The platform is requesting that UI be rendered with darker colors. /// /// Only supported on iOS. - bool get highContrast => _kHighContrastIndex & _index != 0; + bool/*!*/ get highContrast => _kHighContrastIndex & _index != 0; @override - String toString() { + String/*!*/ toString() { final List features = []; if (accessibleNavigation) features.add('accessibleNavigation'); @@ -1280,7 +1281,7 @@ class AccessibilityFeatures { } @override - bool operator ==(dynamic other) { + bool/*!*/ operator ==(dynamic other) { if (other.runtimeType != runtimeType) return false; return other is AccessibilityFeatures @@ -1288,7 +1289,7 @@ class AccessibilityFeatures { } @override - int get hashCode => _index.hashCode; + int/*!*/ get hashCode => _index.hashCode; } /// Describes the contrast of a theme or color palette. @@ -1321,4 +1322,4 @@ enum Brightness { /// The only place that `WidgetsBinding.instance.window` is inappropriate is if /// a `Window` is required before invoking `runApp()`. In that case, it is /// acceptable (though unfortunate) to use this object statically. -final Window window = Window._(); +final Window/*!*/ window = Window._(); diff --git a/lib/web_ui/lib/src/engine.dart b/lib/web_ui/lib/src/engine.dart index 93cf6608a7e..7036705f038 100644 --- a/lib/web_ui/lib/src/engine.dart +++ b/lib/web_ui/lib/src/engine.dart @@ -184,7 +184,7 @@ void webOnlyInitializeEngine() { } bool waitingForAnimation = false; - ui.webOnlyScheduleFrameCallback = () { + scheduleFrameCallback = () { // We're asked to schedule a frame and call `frameHandler` when the frame // fires. if (!waitingForAnimation) { diff --git a/lib/web_ui/lib/src/engine/window.dart b/lib/web_ui/lib/src/engine/window.dart index a817b5949a1..efa7ea83d0c 100644 --- a/lib/web_ui/lib/src/engine/window.dart +++ b/lib/web_ui/lib/src/engine/window.dart @@ -8,6 +8,11 @@ part of engine; /// When set to true, all platform messages will be printed to the console. const bool _debugPrintPlatformMessages = false; +/// Requests that the browser schedule a frame. +/// +/// This may be overridden in tests, for example, to pump fake frames. +ui.VoidCallback scheduleFrameCallback; + /// The Web implementation of [ui.Window]. class EngineWindow extends ui.Window { EngineWindow() { @@ -156,6 +161,15 @@ class EngineWindow extends ui.Window { @override String/*!*/ get defaultRouteName => _defaultRouteName ??= _browserHistory.currentPath; + @override + void scheduleFrame() { + if (scheduleFrameCallback == null) { + throw new Exception( + 'scheduleFrameCallback must be initialized first.'); + } + scheduleFrameCallback(); + } + /// Change the strategy to use for handling browser history location. /// Setting this member will automatically update [_browserHistory]. /// @@ -198,9 +212,9 @@ class EngineWindow extends ui.Window { } @override - ui.VoidCallback get onMetricsChanged => _onMetricsChanged; - ui.VoidCallback _onMetricsChanged; - Zone _onMetricsChangedZone; + ui.VoidCallback/*?*/ get onMetricsChanged => _onMetricsChanged; + ui.VoidCallback/*?*/ _onMetricsChanged; + Zone/*!*/ _onMetricsChangedZone = Zone.root; @override set onMetricsChanged(ui.VoidCallback callback) { _onMetricsChanged = callback; @@ -766,7 +780,7 @@ void _invoke3( /// `dart:ui` window delegates to this value. However, this value has a wider /// API surface, providing Web-specific functionality that the standard /// `dart:ui` version does not. -final EngineWindow window = EngineWindow(); +final EngineWindow/*!*/ window = EngineWindow(); /// The Web implementation of [ui.WindowPadding]. class WindowPadding implements ui.WindowPadding { diff --git a/lib/web_ui/lib/src/ui/test_embedding.dart b/lib/web_ui/lib/src/ui/test_embedding.dart index 471876706c0..f968813a8f7 100644 --- a/lib/web_ui/lib/src/ui/test_embedding.dart +++ b/lib/web_ui/lib/src/ui/test_embedding.dart @@ -40,7 +40,7 @@ Future webOnlyInitializeTestDomRenderer({double devicePixelRatio = 3.0}) { engine.window.debugOverrideDevicePixelRatio(devicePixelRatio); engine.window.webOnlyDebugPhysicalSizeOverride = Size(800 * devicePixelRatio, 600 * devicePixelRatio); - webOnlyScheduleFrameCallback = () {}; + engine.scheduleFrameCallback = () {}; debugEmulateFlutterTesterEnvironment = true; if (_platformInitializedFuture != null) { diff --git a/lib/web_ui/lib/src/ui/window.dart b/lib/web_ui/lib/src/ui/window.dart index 42b4fb9fea4..0b8992032d8 100644 --- a/lib/web_ui/lib/src/ui/window.dart +++ b/lib/web_ui/lib/src/ui/window.dart @@ -15,27 +15,27 @@ typedef VoidCallback = void Function(); /// scheduler's epoch. Use timeStamp to determine how far to advance animation /// timelines so that all the animations in the system are synchronized to a /// common time base. -typedef FrameCallback = void Function(Duration duration); +typedef FrameCallback = void Function(Duration/*!*/ duration); /// Signature for [Window.onReportTimings]. -typedef TimingsCallback = void Function(List timings); +typedef TimingsCallback = void Function(List/*!*/ timings); /// Signature for [Window.onPointerDataPacket]. -typedef PointerDataPacketCallback = void Function(PointerDataPacket packet); +typedef PointerDataPacketCallback = void Function(PointerDataPacket/*!*/ packet); /// Signature for [Window.onSemanticsAction]. typedef SemanticsActionCallback = void Function( - int id, SemanticsAction action, ByteData args); + int/*!*/ id, SemanticsAction/*!*/ action, ByteData/*?*/ args); /// Signature for responses to platform messages. /// /// Used as a parameter to [Window.sendPlatformMessage] and /// [Window.onPlatformMessage]. -typedef PlatformMessageResponseCallback = void Function(ByteData data); +typedef PlatformMessageResponseCallback = void Function(ByteData/*?*/ data); /// Signature for [Window.onPlatformMessage]. typedef PlatformMessageCallback = void Function( - String name, ByteData data, PlatformMessageResponseCallback callback); + String/*!*/ name, ByteData/*?*/ data, PlatformMessageResponseCallback/*?*/ callback); /// States that an application can be in. /// @@ -110,19 +110,19 @@ abstract class WindowPadding { /// The distance from the left edge to the first unpadded pixel, in physical /// pixels. - final double left; + final double/*!*/ left; /// The distance from the top edge to the first unpadded pixel, in physical /// pixels. - final double top; + final double/*!*/ top; /// The distance from the right edge to the first unpadded pixel, in physical /// pixels. - final double right; + final double/*!*/ right; /// The distance from the bottom edge to the first unpadded pixel, in physical /// pixels. - final double bottom; + final double/*!*/ bottom; /// A window padding that has zeros for each edge. static const WindowPadding zero = @@ -208,9 +208,9 @@ class Locale { /// Validity is not checked by default, but some methods may throw away /// invalid data. const Locale.fromSubtags({ - String languageCode = 'und', + String/*!*/ languageCode = 'und', this.scriptCode, - String countryCode, + String/*?*/ countryCode, }) : assert(languageCode != null), assert(languageCode != ''), _languageCode = languageCode, @@ -241,173 +241,91 @@ class Locale { /// /// * [new Locale.fromSubtags], which describes the conventions for creating /// [Locale] objects. - String get languageCode => _replaceDeprecatedLanguageSubtag(_languageCode); - final String _languageCode; + String/*!*/ get languageCode => _deprecatedLanguageSubtagMap[_languageCode] ?? _languageCode; + final String/*!*/ _languageCode; - static String _replaceDeprecatedLanguageSubtag(String languageCode) { - // This switch statement is generated by //flutter/tools/gen_locale.dart - // Mappings generated for language subtag registry as of 2018-08-08. - switch (languageCode) { - case 'in': - return 'id'; // Indonesian; deprecated 1989-01-01 - case 'iw': - return 'he'; // Hebrew; deprecated 1989-01-01 - case 'ji': - return 'yi'; // Yiddish; deprecated 1989-01-01 - case 'jw': - return 'jv'; // Javanese; deprecated 2001-08-13 - case 'mo': - return 'ro'; // Moldavian, Moldovan; deprecated 2008-11-22 - case 'aam': - return 'aas'; // Aramanik; deprecated 2015-02-12 - case 'adp': - return 'dz'; // Adap; deprecated 2015-02-12 - case 'aue': - return 'ktz'; // =/Kx'au//'ein; deprecated 2015-02-12 - case 'ayx': - return 'nun'; // Ayi (China); deprecated 2011-08-16 - case 'bgm': - return 'bcg'; // Baga Mboteni; deprecated 2016-05-30 - case 'bjd': - return 'drl'; // Bandjigali; deprecated 2012-08-12 - case 'ccq': - return 'rki'; // Chaungtha; deprecated 2012-08-12 - case 'cjr': - return 'mom'; // Chorotega; deprecated 2010-03-11 - case 'cka': - return 'cmr'; // Khumi Awa Chin; deprecated 2012-08-12 - case 'cmk': - return 'xch'; // Chimakum; deprecated 2010-03-11 - case 'coy': - return 'pij'; // Coyaima; deprecated 2016-05-30 - case 'cqu': - return 'quh'; // Chilean Quechua; deprecated 2016-05-30 - case 'drh': - return 'khk'; // Darkhat; deprecated 2010-03-11 - case 'drw': - return 'prs'; // Darwazi; deprecated 2010-03-11 - case 'gav': - return 'dev'; // Gabutamon; deprecated 2010-03-11 - case 'gfx': - return 'vaj'; // Mangetti Dune !Xung; deprecated 2015-02-12 - case 'ggn': - return 'gvr'; // Eastern Gurung; deprecated 2016-05-30 - case 'gti': - return 'nyc'; // Gbati-ri; deprecated 2015-02-12 - case 'guv': - return 'duz'; // Gey; deprecated 2016-05-30 - case 'hrr': - return 'jal'; // Horuru; deprecated 2012-08-12 - case 'ibi': - return 'opa'; // Ibilo; deprecated 2012-08-12 - case 'ilw': - return 'gal'; // Talur; deprecated 2013-09-10 - case 'jeg': - return 'oyb'; // Jeng; deprecated 2017-02-23 - case 'kgc': - return 'tdf'; // Kasseng; deprecated 2016-05-30 - case 'kgh': - return 'kml'; // Upper Tanudan Kalinga; deprecated 2012-08-12 - case 'koj': - return 'kwv'; // Sara Dunjo; deprecated 2015-02-12 - case 'krm': - return 'bmf'; // Krim; deprecated 2017-02-23 - case 'ktr': - return 'dtp'; // Kota Marudu Tinagas; deprecated 2016-05-30 - case 'kvs': - return 'gdj'; // Kunggara; deprecated 2016-05-30 - case 'kwq': - return 'yam'; // Kwak; deprecated 2015-02-12 - case 'kxe': - return 'tvd'; // Kakihum; deprecated 2015-02-12 - case 'kzj': - return 'dtp'; // Coastal Kadazan; deprecated 2016-05-30 - case 'kzt': - return 'dtp'; // Tambunan Dusun; deprecated 2016-05-30 - case 'lii': - return 'raq'; // Lingkhim; deprecated 2015-02-12 - case 'lmm': - return 'rmx'; // Lamam; deprecated 2014-02-28 - case 'meg': - return 'cir'; // Mea; deprecated 2013-09-10 - case 'mst': - return 'mry'; // Cataelano Mandaya; deprecated 2010-03-11 - case 'mwj': - return 'vaj'; // Maligo; deprecated 2015-02-12 - case 'myt': - return 'mry'; // Sangab Mandaya; deprecated 2010-03-11 - case 'nad': - return 'xny'; // Nijadali; deprecated 2016-05-30 - case 'ncp': - return 'kdz'; // Ndaktup; deprecated 2018-03-08 - case 'nnx': - return 'ngv'; // Ngong; deprecated 2015-02-12 - case 'nts': - return 'pij'; // Natagaimas; deprecated 2016-05-30 - case 'oun': - return 'vaj'; // !O!ung; deprecated 2015-02-12 - case 'pcr': - return 'adx'; // Panang; deprecated 2013-09-10 - case 'pmc': - return 'huw'; // Palumata; deprecated 2016-05-30 - case 'pmu': - return 'phr'; // Mirpur Panjabi; deprecated 2015-02-12 - case 'ppa': - return 'bfy'; // Pao; deprecated 2016-05-30 - case 'ppr': - return 'lcq'; // Piru; deprecated 2013-09-10 - case 'pry': - return 'prt'; // Pray 3; deprecated 2016-05-30 - case 'puz': - return 'pub'; // Purum Naga; deprecated 2014-02-28 - case 'sca': - return 'hle'; // Sansu; deprecated 2012-08-12 - case 'skk': - return 'oyb'; // Sok; deprecated 2017-02-23 - case 'tdu': - return 'dtp'; // Tempasuk Dusun; deprecated 2016-05-30 - case 'thc': - return 'tpo'; // Tai Hang Tong; deprecated 2016-05-30 - case 'thx': - return 'oyb'; // The; deprecated 2015-02-12 - case 'tie': - return 'ras'; // Tingal; deprecated 2011-08-16 - case 'tkk': - return 'twm'; // Takpa; deprecated 2011-08-16 - case 'tlw': - return 'weo'; // South Wemale; deprecated 2012-08-12 - case 'tmp': - return 'tyj'; // Tai Mène; deprecated 2016-05-30 - case 'tne': - return 'kak'; // Tinoc Kallahan; deprecated 2016-05-30 - case 'tnf': - return 'prs'; // Tangshewi; deprecated 2010-03-11 - case 'tsf': - return 'taj'; // Southwestern Tamang; deprecated 2015-02-12 - case 'uok': - return 'ema'; // Uokha; deprecated 2015-02-12 - case 'xba': - return 'cax'; // Kamba (Brazil); deprecated 2016-05-30 - case 'xia': - return 'acn'; // Xiandao; deprecated 2013-09-10 - case 'xkh': - return 'waw'; // Karahawyana; deprecated 2016-05-30 - case 'xsj': - return 'suj'; // Subi; deprecated 2015-02-12 - case 'ybd': - return 'rki'; // Yangbye; deprecated 2012-08-12 - case 'yma': - return 'lrr'; // Yamphe; deprecated 2012-08-12 - case 'ymt': - return 'mtm'; // Mator-Taygi-Karagas; deprecated 2015-02-12 - case 'yos': - return 'zom'; // Yos; deprecated 2013-09-10 - case 'yuu': - return 'yug'; // Yugh; deprecated 2014-02-28 - default: - return languageCode; - } - } + // This map is generated by //flutter/tools/gen_locale.dart + // Mappings generated for language subtag registry as of 2019-02-27. + static const Map _deprecatedLanguageSubtagMap = { + 'in': 'id', // Indonesian; deprecated 1989-01-01 + 'iw': 'he', // Hebrew; deprecated 1989-01-01 + 'ji': 'yi', // Yiddish; deprecated 1989-01-01 + 'jw': 'jv', // Javanese; deprecated 2001-08-13 + 'mo': 'ro', // Moldavian, Moldovan; deprecated 2008-11-22 + 'aam': 'aas', // Aramanik; deprecated 2015-02-12 + 'adp': 'dz', // Adap; deprecated 2015-02-12 + 'aue': 'ktz', // ǂKxʼauǁʼein; deprecated 2015-02-12 + 'ayx': 'nun', // Ayi (China); deprecated 2011-08-16 + 'bgm': 'bcg', // Baga Mboteni; deprecated 2016-05-30 + 'bjd': 'drl', // Bandjigali; deprecated 2012-08-12 + 'ccq': 'rki', // Chaungtha; deprecated 2012-08-12 + 'cjr': 'mom', // Chorotega; deprecated 2010-03-11 + 'cka': 'cmr', // Khumi Awa Chin; deprecated 2012-08-12 + 'cmk': 'xch', // Chimakum; deprecated 2010-03-11 + 'coy': 'pij', // Coyaima; deprecated 2016-05-30 + 'cqu': 'quh', // Chilean Quechua; deprecated 2016-05-30 + 'drh': 'khk', // Darkhat; deprecated 2010-03-11 + 'drw': 'prs', // Darwazi; deprecated 2010-03-11 + 'gav': 'dev', // Gabutamon; deprecated 2010-03-11 + 'gfx': 'vaj', // Mangetti Dune ǃXung; deprecated 2015-02-12 + 'ggn': 'gvr', // Eastern Gurung; deprecated 2016-05-30 + 'gti': 'nyc', // Gbati-ri; deprecated 2015-02-12 + 'guv': 'duz', // Gey; deprecated 2016-05-30 + 'hrr': 'jal', // Horuru; deprecated 2012-08-12 + 'ibi': 'opa', // Ibilo; deprecated 2012-08-12 + 'ilw': 'gal', // Talur; deprecated 2013-09-10 + 'jeg': 'oyb', // Jeng; deprecated 2017-02-23 + 'kgc': 'tdf', // Kasseng; deprecated 2016-05-30 + 'kgh': 'kml', // Upper Tanudan Kalinga; deprecated 2012-08-12 + 'koj': 'kwv', // Sara Dunjo; deprecated 2015-02-12 + 'krm': 'bmf', // Krim; deprecated 2017-02-23 + 'ktr': 'dtp', // Kota Marudu Tinagas; deprecated 2016-05-30 + 'kvs': 'gdj', // Kunggara; deprecated 2016-05-30 + 'kwq': 'yam', // Kwak; deprecated 2015-02-12 + 'kxe': 'tvd', // Kakihum; deprecated 2015-02-12 + 'kzj': 'dtp', // Coastal Kadazan; deprecated 2016-05-30 + 'kzt': 'dtp', // Tambunan Dusun; deprecated 2016-05-30 + 'lii': 'raq', // Lingkhim; deprecated 2015-02-12 + 'lmm': 'rmx', // Lamam; deprecated 2014-02-28 + 'meg': 'cir', // Mea; deprecated 2013-09-10 + 'mst': 'mry', // Cataelano Mandaya; deprecated 2010-03-11 + 'mwj': 'vaj', // Maligo; deprecated 2015-02-12 + 'myt': 'mry', // Sangab Mandaya; deprecated 2010-03-11 + 'nad': 'xny', // Nijadali; deprecated 2016-05-30 + 'ncp': 'kdz', // Ndaktup; deprecated 2018-03-08 + 'nnx': 'ngv', // Ngong; deprecated 2015-02-12 + 'nts': 'pij', // Natagaimas; deprecated 2016-05-30 + 'oun': 'vaj', // ǃOǃung; deprecated 2015-02-12 + 'pcr': 'adx', // Panang; deprecated 2013-09-10 + 'pmc': 'huw', // Palumata; deprecated 2016-05-30 + 'pmu': 'phr', // Mirpur Panjabi; deprecated 2015-02-12 + 'ppa': 'bfy', // Pao; deprecated 2016-05-30 + 'ppr': 'lcq', // Piru; deprecated 2013-09-10 + 'pry': 'prt', // Pray 3; deprecated 2016-05-30 + 'puz': 'pub', // Purum Naga; deprecated 2014-02-28 + 'sca': 'hle', // Sansu; deprecated 2012-08-12 + 'skk': 'oyb', // Sok; deprecated 2017-02-23 + 'tdu': 'dtp', // Tempasuk Dusun; deprecated 2016-05-30 + 'thc': 'tpo', // Tai Hang Tong; deprecated 2016-05-30 + 'thx': 'oyb', // The; deprecated 2015-02-12 + 'tie': 'ras', // Tingal; deprecated 2011-08-16 + 'tkk': 'twm', // Takpa; deprecated 2011-08-16 + 'tlw': 'weo', // South Wemale; deprecated 2012-08-12 + 'tmp': 'tyj', // Tai Mène; deprecated 2016-05-30 + 'tne': 'kak', // Tinoc Kallahan; deprecated 2016-05-30 + 'tnf': 'prs', // Tangshewi; deprecated 2010-03-11 + 'tsf': 'taj', // Southwestern Tamang; deprecated 2015-02-12 + 'uok': 'ema', // Uokha; deprecated 2015-02-12 + 'xba': 'cax', // Kamba (Brazil); deprecated 2016-05-30 + 'xia': 'acn', // Xiandao; deprecated 2013-09-10 + 'xkh': 'waw', // Karahawyana; deprecated 2016-05-30 + 'xsj': 'suj', // Subi; deprecated 2015-02-12 + 'ybd': 'rki', // Yangbye; deprecated 2012-08-12 + 'yma': 'lrr', // Yamphe; deprecated 2012-08-12 + 'ymt': 'mtm', // Mator-Taygi-Karagas; deprecated 2015-02-12 + 'yos': 'zom', // Yos; deprecated 2013-09-10 + 'yuu': 'yug', // Yugh; deprecated 2014-02-28 + }; /// The script subtag for the locale. /// @@ -421,7 +339,7 @@ class Locale { /// /// * [new Locale.fromSubtags], which describes the conventions for creating /// [Locale] objects. - final String scriptCode; + final String/*?*/ scriptCode; /// The region subtag for the locale. /// @@ -442,32 +360,22 @@ class Locale { /// /// * [new Locale.fromSubtags], which describes the conventions for creating /// [Locale] objects. - String get countryCode => _replaceDeprecatedRegionSubtag(_countryCode); - final String _countryCode; + String/*?*/ get countryCode => _deprecatedRegionSubtagMap[_countryCode] ?? _countryCode; + final String/*?*/ _countryCode; - static String _replaceDeprecatedRegionSubtag(String regionCode) { - // This switch statement is generated by //flutter/tools/gen_locale.dart - // Mappings generated for language subtag registry as of 2018-08-08. - switch (regionCode) { - case 'BU': - return 'MM'; // Burma; deprecated 1989-12-05 - case 'DD': - return 'DE'; // German Democratic Republic; deprecated 1990-10-30 - case 'FX': - return 'FR'; // Metropolitan France; deprecated 1997-07-14 - case 'TP': - return 'TL'; // East Timor; deprecated 2002-05-20 - case 'YD': - return 'YE'; // Democratic Yemen; deprecated 1990-08-14 - case 'ZR': - return 'CD'; // Zaire; deprecated 1997-07-14 - default: - return regionCode; - } - } + // This map is generated by //flutter/tools/gen_locale.dart + // Mappings generated for language subtag registry as of 2019-02-27. + static const Map _deprecatedRegionSubtagMap = { + 'BU': 'MM', // Burma; deprecated 1989-12-05 + 'DD': 'DE', // German Democratic Republic; deprecated 1990-10-30 + 'FX': 'FR', // Metropolitan France; deprecated 1997-07-14 + 'TP': 'TL', // East Timor; deprecated 2002-05-20 + 'YD': 'YE', // Democratic Yemen; deprecated 1990-08-14 + 'ZR': 'CD', // Zaire; deprecated 1997-07-14 + }; @override - bool operator ==(dynamic other) { + bool/*!*/ operator ==(dynamic other) { if (identical(this, other)) { return true; } @@ -481,15 +389,15 @@ class Locale { } @override - int get hashCode => hashValues(languageCode, scriptCode, countryCode); + int/*!*/ get hashCode => hashValues(languageCode, scriptCode, countryCode); @override - String toString() => _rawToString('_'); + String/*!*/ toString() => _rawToString('_'); // TODO(yjbanov): implement to match flutter native. String toLanguageTag() => _rawToString('-'); - String _rawToString(String separator) { + String/*!*/ _rawToString(String separator) { final StringBuffer out = StringBuffer(languageCode); if (scriptCode != null) { out.write('$separator$scriptCode'); @@ -529,7 +437,7 @@ abstract class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. - double get devicePixelRatio; + double/*!*/ get devicePixelRatio; /// The dimensions of the rectangle into which the application will be drawn, /// in physical pixels. @@ -548,7 +456,7 @@ abstract class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. - Size get physicalSize; + Size/*!*/ get physicalSize; /// The physical depth is the maximum elevation that the Window allows. /// @@ -561,7 +469,7 @@ abstract class Window { /// The default value is [double.maxFinite], which is used for platforms that /// do not specify a maximum elevation. This property is currently on expected /// to be set to a non-default value on Fuchsia. - double get physicalDepth; + double/*!*/ get physicalDepth; /// The number of physical pixels on each side of the display rectangle into /// which the application can render, but over which the operating system @@ -577,11 +485,11 @@ abstract class Window { /// * [MediaQuery.of], a simpler mechanism for the same. /// * [Scaffold], which automatically applies the view insets in material /// design applications. - WindowPadding get viewInsets => WindowPadding.zero; + WindowPadding/*!*/ get viewInsets => WindowPadding.zero; - WindowPadding get viewPadding => WindowPadding.zero; + WindowPadding/*!*/ get viewPadding => WindowPadding.zero; - WindowPadding get systemGestureInsets => WindowPadding.zero; + WindowPadding/*!*/ get systemGestureInsets => WindowPadding.zero; /// The number of physical pixels on each side of the display rectangle into /// which the application can render, but which may be partially obscured by @@ -598,7 +506,7 @@ abstract class Window { /// * [MediaQuery.of], a simpler mechanism for the same. /// * [Scaffold], which automatically applies the padding in material design /// applications. - WindowPadding get padding => WindowPadding.zero; + WindowPadding/*!*/ get padding => WindowPadding.zero; /// The system-reported text scale. /// @@ -612,15 +520,15 @@ abstract class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. - double get textScaleFactor => _textScaleFactor; - double _textScaleFactor = 1.0; + double/*!*/ get textScaleFactor => _textScaleFactor; + double/*!*/ _textScaleFactor = 1.0; /// The setting indicating whether time should always be shown in the 24-hour /// format. /// /// This option is used by [showTimePicker]. - bool get alwaysUse24HourFormat => _alwaysUse24HourFormat; - bool _alwaysUse24HourFormat = false; + bool/*!*/ get alwaysUse24HourFormat => _alwaysUse24HourFormat; + bool/*!*/ _alwaysUse24HourFormat = false; /// A callback that is invoked whenever [textScaleFactor] changes value. /// @@ -631,11 +539,11 @@ abstract class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this callback is invoked. - VoidCallback get onTextScaleFactorChanged; - set onTextScaleFactorChanged(VoidCallback callback); + VoidCallback/*?*/ get onTextScaleFactorChanged; + set onTextScaleFactorChanged(VoidCallback/*?*/ callback); /// The setting indicating the current brightness mode of the host platform. - Brightness get platformBrightness; + Brightness/*!*/ get platformBrightness; /// A callback that is invoked whenever [platformBrightness] changes value. /// @@ -646,8 +554,8 @@ abstract class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this callback is invoked. - VoidCallback get onPlatformBrightnessChanged; - set onPlatformBrightnessChanged(VoidCallback callback); + VoidCallback/*?*/ get onPlatformBrightnessChanged; + set onPlatformBrightnessChanged(VoidCallback/*?*/ callback); /// A callback that is invoked whenever the [devicePixelRatio], /// [physicalSize], [padding], or [viewInsets] values change, for example @@ -665,8 +573,8 @@ abstract class Window { /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// register for notifications when this is called. /// * [MediaQuery.of], a simpler mechanism for the same. - VoidCallback get onMetricsChanged; - set onMetricsChanged(VoidCallback callback); + VoidCallback/*?*/ get onMetricsChanged; + set onMetricsChanged(VoidCallback/*?*/ callback); /// The system-reported default locale of the device. /// @@ -678,7 +586,7 @@ abstract class Window { /// /// This is equivalent to `locales.first` and will provide an empty non-null locale /// if the [locales] list has not been set or is empty. - Locale get locale; + Locale/*?*/ get locale; /// The full system-reported supported locales of the device. /// @@ -694,7 +602,7 @@ abstract class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. - List get locales; + List/*?*/ get locales; /// The locale that the platform's native locale resolution system resolves to. /// @@ -706,7 +614,7 @@ abstract class Window { /// in order to arrive at the most appropriate locale for the app. /// /// See [locales], which is the list of locales the user/device prefers. - Locale get platformResolvedLocale; + Locale/*?*/ get platformResolvedLocale; /// A callback that is invoked whenever [locale] changes value. /// @@ -717,8 +625,8 @@ abstract class Window { /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this callback is invoked. - VoidCallback get onLocaleChanged; - set onLocaleChanged(VoidCallback callback); + VoidCallback/*?*/ get onLocaleChanged; + set onLocaleChanged(VoidCallback/*?*/ callback); /// Requests that, at the next appropriate opportunity, the [onBeginFrame] /// and [onDrawFrame] callbacks be invoked. @@ -727,13 +635,7 @@ abstract class Window { /// /// * [SchedulerBinding], the Flutter framework class which manages the /// scheduling of frames. - void scheduleFrame() { - if (webOnlyScheduleFrameCallback == null) { - throw new Exception( - 'webOnlyScheduleFrameCallback must be initialized first.'); - } - webOnlyScheduleFrameCallback(); - } + void scheduleFrame(); /// A callback that is invoked to notify the application that it is an /// appropriate time to provide a scene using the [SceneBuilder] API and the @@ -754,8 +656,8 @@ abstract class Window { /// scheduling of frames. /// * [RendererBinding], the Flutter framework class which manages layout and /// painting. - FrameCallback get onBeginFrame; - set onBeginFrame(FrameCallback callback); + FrameCallback/*?*/ get onBeginFrame; + set onBeginFrame(FrameCallback/*?*/ callback); /// A callback that is invoked to report the [FrameTiming] of recently /// rasterized frames. @@ -773,8 +675,8 @@ abstract class Window { /// decrease the overhead (as this is available in the release mode). The /// timing of any frame will be sent within about 1 second even if there are /// no later frames to batch. - TimingsCallback get onReportTimings; - set onReportTimings(TimingsCallback callback); + TimingsCallback/*?*/ get onReportTimings; + set onReportTimings(TimingsCallback/*?*/ callback); /// A callback that is invoked for each frame after [onBeginFrame] has /// completed and after the microtask queue has been drained. This can be @@ -790,8 +692,8 @@ abstract class Window { /// scheduling of frames. /// * [RendererBinding], the Flutter framework class which manages layout and /// painting. - VoidCallback get onDrawFrame; - set onDrawFrame(VoidCallback callback); + VoidCallback/*?*/ get onDrawFrame; + set onDrawFrame(VoidCallback/*?*/ callback); /// A callback that is invoked when pointer data is available. /// @@ -802,8 +704,8 @@ abstract class Window { /// /// * [GestureBinding], the Flutter framework class which manages pointer /// events. - PointerDataPacketCallback get onPointerDataPacket; - set onPointerDataPacket(PointerDataPacketCallback callback); + PointerDataPacketCallback/*?*/ get onPointerDataPacket; + set onPointerDataPacket(PointerDataPacketCallback/*?*/ callback); /// The route or path that the embedder requested when the application was /// launched. @@ -845,15 +747,15 @@ abstract class Window { /// /// This defaults to `true` on the Web because we may never receive a signal /// that an assistive technology is turned on. - bool get semanticsEnabled => + bool/*!*/ get semanticsEnabled => engine.EngineSemanticsOwner.instance.semanticsEnabled; /// A callback that is invoked when the value of [semanticsEnabled] changes. /// /// The framework invokes this callback in the same zone in which the /// callback was set. - VoidCallback get onSemanticsEnabledChanged; - set onSemanticsEnabledChanged(VoidCallback callback); + VoidCallback/*?*/ get onSemanticsEnabledChanged; + set onSemanticsEnabledChanged(VoidCallback/*?*/ callback); /// A callback that is invoked whenever the user requests an action to be /// performed. @@ -863,15 +765,15 @@ abstract class Window { /// /// The framework invokes this callback in the same zone in which the /// callback was set. - SemanticsActionCallback get onSemanticsAction; - set onSemanticsAction(SemanticsActionCallback callback); + SemanticsActionCallback/*?*/ get onSemanticsAction; + set onSemanticsAction(SemanticsActionCallback/*?*/ callback); /// A callback that is invoked when the value of [accessibilityFlags] changes. /// /// The framework invokes this callback in the same zone in which the /// callback was set. - VoidCallback get onAccessibilityFeaturesChanged; - set onAccessibilityFeaturesChanged(VoidCallback callback); + VoidCallback/*?*/ get onAccessibilityFeaturesChanged; + set onAccessibilityFeaturesChanged(VoidCallback/*?*/ callback); /// Called whenever this window receives a message from a platform-specific /// plugin. @@ -886,8 +788,8 @@ abstract class Window { /// /// The framework invokes this callback in the same zone in which the /// callback was set. - PlatformMessageCallback get onPlatformMessage; - set onPlatformMessage(PlatformMessageCallback callback); + PlatformMessageCallback/*?*/ get onPlatformMessage; + set onPlatformMessage(PlatformMessageCallback/*?*/ callback); /// Change the retained semantics data about this window. /// @@ -916,8 +818,8 @@ abstract class Window { ); /// Additional accessibility features that may be enabled by the platform. - AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures; - AccessibilityFeatures _accessibilityFeatures = AccessibilityFeatures._(0); + AccessibilityFeatures/*!*/ get accessibilityFeatures => _accessibilityFeatures; + AccessibilityFeatures/*!*/ _accessibilityFeatures = AccessibilityFeatures._(0); /// Updates the application's rendering on the GPU with the newly provided /// [Scene]. This function must be called within the scope of the @@ -945,17 +847,13 @@ abstract class Window { /// painting. void render(Scene/*!*/ scene); - String get initialLifecycleState => _initialLifecycleState; - - String _initialLifecycleState; + String/*!*/ get initialLifecycleState => 'AppLifecycleState.resumed'; void setIsolateDebugName(String/*!*/ name) {} ByteData/*?*/ getPersistentIsolateData() => null; } -VoidCallback webOnlyScheduleFrameCallback; - /// Additional accessibility features that may be enabled by the platform. /// /// It is not possible to enable these settings from Flutter, instead they are @@ -972,38 +870,38 @@ class AccessibilityFeatures { static const int _kHighContrastIndex = 1 << 5; // A bitfield which represents each enabled feature. - final int _index; + final int/*!*/ _index; /// Whether there is a running accessibility service which is changing the /// interaction model of the device. /// /// For example, TalkBack on Android and VoiceOver on iOS enable this flag. - bool get accessibleNavigation => _kAccessibleNavigation & _index != 0; + bool/*!*/ get accessibleNavigation => _kAccessibleNavigation & _index != 0; /// The platform is inverting the colors of the application. - bool get invertColors => _kInvertColorsIndex & _index != 0; + bool/*!*/ get invertColors => _kInvertColorsIndex & _index != 0; /// The platform is requesting that animations be disabled or simplified. - bool get disableAnimations => _kDisableAnimationsIndex & _index != 0; + bool/*!*/ get disableAnimations => _kDisableAnimationsIndex & _index != 0; /// The platform is requesting that text be rendered at a bold font weight. /// /// Only supported on iOS. - bool get boldText => _kBoldTextIndex & _index != 0; + bool/*!*/ get boldText => _kBoldTextIndex & _index != 0; /// The platform is requesting that certain animations be simplified and /// parallax effects removed. /// /// Only supported on iOS. - bool get reduceMotion => _kReduceMotionIndex & _index != 0; + bool/*!*/ get reduceMotion => _kReduceMotionIndex & _index != 0; /// The platform is requesting that UI be rendered with darker colors. /// /// Only supported on iOS. - bool get highContrast => _kHighContrastIndex & _index != 0; + bool/*!*/ get highContrast => _kHighContrastIndex & _index != 0; @override - String toString() { + String/*!*/ toString() { final List features = []; if (accessibleNavigation) { features.add('accessibleNavigation'); @@ -1027,7 +925,7 @@ class AccessibilityFeatures { } @override - bool operator ==(dynamic other) { + bool/*!*/ operator ==(dynamic other) { if (other.runtimeType != runtimeType) { return false; } @@ -1036,7 +934,7 @@ class AccessibilityFeatures { } @override - int get hashCode => _index.hashCode; + int/*!*/ get hashCode => _index.hashCode; } /// Describes the contrast of a theme or color palette. @@ -1065,10 +963,10 @@ class CallbackHandle { int/*!*/ toRawHandle() => _handle; @override - bool operator ==(Object other) => identical(this, other); + bool/*!*/ operator ==(Object other) => identical(this, other); @override - int get hashCode => super.hashCode; + int/*!*/ get hashCode => super.hashCode; } // TODO(flutter_web): see https://github.com/flutter/flutter/issues/33615. @@ -1150,15 +1048,15 @@ class FrameTiming { /// /// This constructor is usually only called by the Flutter engine, or a test. /// To get the [FrameTiming] of your app, see [Window.onReportTimings]. - FrameTiming(List timestamps) + FrameTiming(List/*!*/ timestamps) : assert(timestamps.length == FramePhase.values.length), _timestamps = timestamps; /// This is a raw timestamp in microseconds from some epoch. The epoch in all /// [FrameTiming] is the same, but it may not match [DateTime]'s epoch. - int timestampInMicroseconds(FramePhase phase) => _timestamps[phase.index]; + int/*!*/ timestampInMicroseconds(FramePhase phase) => _timestamps[phase.index]; - Duration _rawDuration(FramePhase phase) => + Duration/*!*/ _rawDuration(FramePhase phase) => Duration(microseconds: _timestamps[phase.index]); /// The duration to build the frame on the UI thread. @@ -1176,7 +1074,7 @@ class FrameTiming { /// {@template dart.ui.FrameTiming.fps_milliseconds} /// That's about 16ms for 60fps, and 8ms for 120fps. /// {@endtemplate} - Duration get buildDuration => + Duration/*!*/ get buildDuration => _rawDuration(FramePhase.buildFinish) - _rawDuration(FramePhase.buildStart); @@ -1184,7 +1082,7 @@ class FrameTiming { /// /// {@macro dart.ui.FrameTiming.fps_smoothness_milliseconds} /// {@macro dart.ui.FrameTiming.fps_milliseconds} - Duration get rasterDuration => + Duration/*!*/ get rasterDuration => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.rasterStart); @@ -1195,11 +1093,11 @@ class FrameTiming { /// {@macro dart.ui.FrameTiming.fps_milliseconds} /// /// See also [buildDuration] and [rasterDuration]. - Duration get totalSpan => + Duration/*!*/ get totalSpan => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.buildStart); - final List _timestamps; // in microseconds + final List/*!*/ _timestamps; // in microseconds String _formatMS(Duration duration) => '${duration.inMicroseconds * 0.001}ms'; @@ -1212,4 +1110,4 @@ class FrameTiming { /// The [Window] singleton. This object exposes the size of the display, the /// core scheduler API, the input event callback, the graphics drawing API, and /// other such core services. -Window get window => engine.window; +Window/*!*/ get window => engine.window;