TestPlatformDispatcher class Null safety
PlatformDispatcher that wraps another PlatformDispatcher and allows faking of some properties for testing purposes.
See also:
- TestWindow, which wraps a SingletonFlutterWindow for testing and mocking purposes.
- Implemented types
Constructors
- TestPlatformDispatcher({required PlatformDispatcher platformDispatcher})
- Constructs a TestPlatformDispatcher that defers all behavior to the given dart:ui.PlatformDispatcher unless explicitly overridden for test purposes.
Properties
- accessibilityFeatures → AccessibilityFeatures
-
Additional accessibility features that may be enabled by the platform.
read-onlyoverride
- accessibilityFeaturesTestValue ← AccessibilityFeatures
-
Hides the real accessibility features and reports the given
accessibilityFeaturesTestValue instead.
write-only
- alwaysUse24HourFormat → bool
-
The setting indicating whether time should always be shown in the 24-hour
format.
read-onlyoverride
- alwaysUse24HourFormatTestValue ← bool
-
Hides the real clock format and reports the given
alwaysUse24HourFormatTestValue instead.
write-only
- brieflyShowPassword → bool
-
Whether briefly displaying the characters as you type in obscured text
fields is enabled in system settings.
read-onlyoverride
- brieflyShowPasswordTestValue ← bool
-
Hides the real brieflyShowPassword and reports the given
brieflyShowPasswordTestValue
instead.write-only - configuration → PlatformConfiguration
-
The current platform configuration.
read-onlyoverride
- defaultRouteName → String
-
The route or path that the embedder requested when the application was
launched.
read-onlyoverride
- defaultRouteNameTestValue ← String
-
Hides the real default route name and reports the given
defaultRouteNameTestValue instead.
write-only
- frameData → FrameData
-
The FrameData object for the current frame.
read-onlyoverride
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- initialLifecycleState → String
-
The lifecycle state immediately after dart isolate initialization.
read-onlyoverride
- initialLifecycleStateTestValue ← String
-
Sets a faked initialLifecycleState for testing.
write-only
- locale → Locale
-
The system-reported default locale of the device.
read-onlyoverride
-
locales
→ List<
Locale> -
The full system-reported supported locales of the device.
read-onlyoverride
-
localesTestValue
← List<
Locale> -
Hides the real locales and reports the given localesTestValue instead.
write-only
- localeTestValue ← Locale
-
Hides the real locale and reports the given localeTestValue instead.
write-only
- nativeSpellCheckServiceDefined → bool
-
Whether the spell check service is supported on the current platform.
read-onlyinherited
- onAccessibilityFeaturesChanged ↔ VoidCallback?
-
A callback that is invoked when the value of accessibilityFeatures
changes.
read / writeoverride
- onBeginFrame ↔ FrameCallback?
-
A callback invoked when any view begins a frame.
read / writeoverride
- onDrawFrame ↔ VoidCallback?
-
A callback that is invoked for each frame after onBeginFrame has
completed and after the microtask queue has been drained.
read / writeoverride
- onError ↔ ErrorCallback?
-
A callback that is invoked when an unhandled error occurs in the root
isolate.
read / writeinherited
- onFrameDataChanged ↔ VoidCallback?
-
A callback that is invoked when the window updates the FrameData.
read / writeoverride
- onKeyData ↔ KeyDataCallback?
-
A callback that is invoked when key data is available.
read / writeoverride
- onLocaleChanged ↔ VoidCallback?
-
A callback that is invoked whenever locale changes value.
read / writeoverride
- onMetricsChanged ↔ VoidCallback?
-
A callback that is invoked whenever the ViewConfiguration of any of the
views changes.
read / writeoverride
- onPlatformBrightnessChanged ↔ VoidCallback?
-
A callback that is invoked whenever platformBrightness changes value.
read / writeoverride
- onPlatformConfigurationChanged ↔ VoidCallback?
-
Called when the platform configuration changes.
read / writeoverride
- onPlatformMessage ↔ PlatformMessageCallback?
-
Called whenever this platform dispatcher receives a message from a
platform-specific plugin.
Deprecated('Instead of calling this callback, use ServicesBinding.instance.channelBuffers.push. ' 'This feature was deprecated after v2.1.0-10.0.pre.')">@Deprecated('Instead of calling this callback, use ServicesBinding.instance.channelBuffers.push. ' 'This feature was deprecated after v2.1.0-10.0.pre.')Deprecated('Instead of setting this callback, use ServicesBinding.instance.defaultBinaryMessenger.setMessageHandler. ' 'This feature was deprecated after v2.1.0-10.0.pre.')">@Deprecated('Instead of setting this callback, use ServicesBinding.instance.defaultBinaryMessenger.setMessageHandler. ' 'This feature was deprecated after v2.1.0-10.0.pre.')read / writeoverride
- onPointerDataPacket ↔ PointerDataPacketCallback?
-
A callback that is invoked when pointer data is available.
read / writeoverride
- onReportTimings ↔ TimingsCallback?
-
A callback that is invoked to report the FrameTiming of recently
rasterized frames.
read / writeoverride
- onSemanticsAction ↔ SemanticsActionCallback?
-
A callback that is invoked whenever the user requests an action to be
performed.
read / writeoverride
- onSemanticsEnabledChanged ↔ VoidCallback?
-
A callback that is invoked when the value of semanticsEnabled changes.
read / writeoverride
- onSystemFontFamilyChanged ↔ VoidCallback?
-
A callback that is invoked whenever systemFontFamily changes value.
read / writeinherited
- onTextScaleFactorChanged ↔ VoidCallback?
-
A callback that is invoked whenever textScaleFactor changes value.
read / writeoverride
- platformBrightness → Brightness
-
The setting indicating the current brightness mode of the host platform.
If the platform has no preference, platformBrightness defaults to
Brightness.light.
read-onlyoverride
- platformBrightnessTestValue ← Brightness
-
Hides the real text scale factor and reports the given
platformBrightnessTestValue instead.
write-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- semanticsEnabled → bool
-
Whether the user has requested that updateSemantics be called when the
semantic contents of a view changes.
read-onlyoverride
- semanticsEnabledTestValue ← bool
-
Hides the real semantics enabled and reports the given
semanticsEnabledTestValue instead.
write-only
- systemFontFamily → String?
-
The setting indicating the current system font of the host platform.
read-onlyinherited
- textScaleFactor → double
-
The system-reported text scale.
read-onlyoverride
- textScaleFactorTestValue ← double
-
Hides the real text scale factor and reports the given
textScaleFactorTestValue instead.
write-only
-
views
→ Iterable<
FlutterView> -
The current list of views, including top level platform windows used by
the application.
read-onlyoverride
Methods
-
clearAccessibilityFeaturesTestValue(
) → void - Deletes any existing test accessibility features and returns to using the real accessibility features.
-
clearAllTestValues(
) → void - Delete any test value properties that have been set on this TestPlatformDispatcher and return to reporting the real ui.PlatformDispatcher values for all PlatformDispatcher properties.
-
clearAlwaysUse24HourTestValue(
) → void - Deletes any existing test clock format and returns to using the real clock format.
-
clearDefaultRouteNameTestValue(
) → void - Deletes any existing test default route name and returns to using the real default route name.
-
clearLocalesTestValue(
) → void - Deletes any existing test locales and returns to using the real locales.
-
clearLocaleTestValue(
) → void - Deletes any existing test locale and returns to using the real locale.
-
clearPlatformBrightnessTestValue(
) → void - Deletes any existing test platform brightness and returns to using the real platform brightness.
-
clearSemanticsEnabledTestValue(
) → void - Deletes any existing test semantics enabled and returns to using the real semantics enabled.
-
clearTextScaleFactorTestValue(
) → void - Deletes any existing test text scale factor and returns to using the real text scale factor.
-
computePlatformResolvedLocale(
List< Locale> supportedLocales) → Locale? -
Performs the platform-native locale resolution.
override
-
getPersistentIsolateData(
) → ByteData? -
The embedder can specify data that the isolate can request synchronously
on launch. This accessor fetches that data.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
This gives us some grace time when the dart:ui side adds something to
PlatformDispatcher, and makes things easier when we do rolls to give
us time to catch up.
override
-
scheduleFrame(
) → void -
Requests that, at the next appropriate opportunity, the onBeginFrame and
onDrawFrame callbacks be invoked.
override
-
sendPlatformMessage(
String name, ByteData? data, PlatformMessageResponseCallback? callback) → void -
Sends a message to a platform-specific plugin.
override
-
setIsolateDebugName(
String name) → void -
Set the debug name associated with this platform dispatcher's root
isolate.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateSemantics(
SemanticsUpdate update) → void -
Change the retained semantics data about this platform dispatcher.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited