TestPlatformDispatcher class
PlatformDispatcher that wraps another PlatformDispatcher and allows faking of some properties for testing purposes.
See also:
- TestFlutterView, which wraps a FlutterView for testing and mocking purposes.
- Implemented types
Constructors
- TestPlatformDispatcher({required PlatformDispatcher platformDispatcher})
- Constructs a TestPlatformDispatcher that defers all behavior to the given PlatformDispatcher unless explicitly overridden for test purposes.
Properties
- accessibilityFeatures → AccessibilityFeatures
-
Additional accessibility features that may be enabled by the platform.
no setteroverride
- accessibilityFeaturesTestValue ← AccessibilityFeatures
-
Hides the real accessibility features and reports the given
accessibilityFeaturesTestValue instead.
no getter
- alwaysUse24HourFormat → bool
-
The setting indicating whether time should always be shown in the 24-hour
format.
no setteroverride
- alwaysUse24HourFormatTestValue ← bool
-
Hides the real clock format and reports the given
alwaysUse24HourFormatTestValue instead.
no getter
- brieflyShowPassword → bool
-
Whether briefly displaying the characters as you type in obscured text
fields is enabled in system settings.
no setteroverride
- brieflyShowPasswordTestValue ← bool
-
Hides the real brieflyShowPassword and reports the given
brieflyShowPasswordTestValue
instead.no getter - defaultRouteName → String
-
The route or path that the embedder requested when the application was
launched.
no setteroverride
- defaultRouteNameTestValue ← String
-
Hides the real default route name and reports the given
defaultRouteNameTestValue instead.
no getter
-
displays
→ Iterable<
TestDisplay> -
The current list of displays.
no setteroverride
- frameData → FrameData
-
The FrameData object for the current frame.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- implicitView → TestFlutterView?
-
The FlutterView provided by the engine if the platform is unable to
create windows, or, for backwards compatibility.
no setteroverride
- initialLifecycleState → String
-
The lifecycle state immediately after dart isolate initialization.
no setteroverride
- initialLifecycleStateTestValue ← String
-
Sets a faked initialLifecycleState for testing.
no getter
- locale → Locale
-
The system-reported default locale of the device.
no setteroverride
-
locales
→ List<
Locale> -
The full system-reported supported locales of the device.
no setteroverride
-
localesTestValue
← List<
Locale> -
Hides the real locales and reports the given localesTestValue instead.
no getter
- localeTestValue ← Locale
-
Hides the real locale and reports the given localeTestValue instead.
no getter
- nativeSpellCheckServiceDefined → bool
-
Whether the spell check service is supported on the current platform.
no setteroverride
- nativeSpellCheckServiceDefinedTestValue ← bool
-
no getter
- onAccessibilityFeaturesChanged ↔ VoidCallback?
-
A callback that is invoked when the value of accessibilityFeatures
changes.
getter/setter pairoverride
- onBeginFrame ↔ FrameCallback?
-
A callback invoked when any view begins a frame.
getter/setter pairoverride
- onDrawFrame ↔ VoidCallback?
-
A callback that is invoked for each frame after onBeginFrame has
completed and after the microtask queue has been drained.
getter/setter pairoverride
- onError ↔ ErrorCallback?
-
A callback that is invoked when an unhandled error occurs in the root
isolate.
getter/setter pairoverride
- onFrameDataChanged ↔ VoidCallback?
-
A callback that is invoked when the window updates the FrameData.
getter/setter pairoverride
- onKeyData ↔ KeyDataCallback?
-
A callback that is invoked when key data is available.
getter/setter pairoverride
- onLocaleChanged ↔ VoidCallback?
-
A callback that is invoked whenever locale changes value.
getter/setter pairoverride
- onMetricsChanged ↔ VoidCallback?
-
A callback that is invoked whenever the ViewConfiguration of any of the
views changes.
getter/setter pairoverride
- onPlatformBrightnessChanged ↔ VoidCallback?
-
A callback that is invoked whenever platformBrightness changes value.
getter/setter pairoverride
- onPlatformConfigurationChanged ↔ VoidCallback?
-
Called when the platform configuration changes.
getter/setter pairoverride
- onPlatformMessage ↔ PlatformMessageCallback?
-
Deprecated. Migrate to ChannelBuffers.setListener instead.
getter/setter pairinherited
- onPointerDataPacket ↔ PointerDataPacketCallback?
-
A callback that is invoked when pointer data is available.
getter/setter pairoverride
- onReportTimings ↔ TimingsCallback?
-
A callback that is invoked to report the FrameTiming of recently
rasterized frames.
getter/setter pairoverride
- onSemanticsActionEvent ↔ SemanticsActionEventCallback?
-
A callback that is invoked whenever the user requests an action to be
performed on a semantics node.
getter/setter pairoverride
- onSemanticsEnabledChanged ↔ VoidCallback?
-
A callback that is invoked when the value of semanticsEnabled changes.
getter/setter pairoverride
- onSystemFontFamilyChanged ↔ VoidCallback?
-
A callback that is invoked whenever systemFontFamily changes value.
getter/setter pairoverride
- onTextScaleFactorChanged ↔ VoidCallback?
-
A callback that is invoked whenever textScaleFactor changes value.
getter/setter pairoverride
- onViewFocusChange ↔ ViewFocusChangeCallback?
-
A callback invoked immediately after the focus is transitioned across FlutterViews.
getter/setter pairoverride
- platformBrightness → Brightness
-
The setting indicating the current brightness mode of the host platform.
If the platform has no preference, platformBrightness defaults to
Brightness.light.
no setteroverride
- platformBrightnessTestValue ← Brightness
-
Hides the real platform brightness and reports the given
platformBrightnessTestValue instead.
no getter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticsEnabled → bool
-
Whether the user has requested that updateSemantics be called when the
semantic contents of a view changes.
no setteroverride
- semanticsEnabledTestValue ← bool
-
Hides the real semantics enabled and reports the given
semanticsEnabledTestValue instead.
no getter
- supportsShowingSystemContextMenu ↔ bool
-
Whether showing system context menu is supported on the current platform.
getter/setter pairoverride-getter
- systemFontFamily ↔ String?
-
The system font family to use for this test.
getter/setter pairoverride-getter
- textScaleFactor → double
-
The system-reported text scale.
no setteroverride
- textScaleFactorTestValue ← double
-
Hides the real text scale factor and reports the given
textScaleFactorTestValue instead.
no getter
-
views
→ Iterable<
TestFlutterView> -
The current list of views, including top level platform windows used by
the application.
no setteroverride
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 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.
-
clearNativeSpellCheckServiceDefined(
) → void - Deletes existing value that determines whether or not a native spell check service is defined and returns to the real value.
-
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
-
registerBackgroundIsolate(
RootIsolateToken token) → void -
Registers the current isolate with the isolate identified with by the
token
. This is required if platform channels are to be used on a background isolate.override -
requestDartPerformanceMode(
DartPerformanceMode mode) → void -
Requests the Dart VM to adjusts the GC heuristics based on the requested
performance_mode
.override -
requestViewFocusChange(
{required int viewId, required ViewFocusState state, required ViewFocusDirection direction}) → void -
Requests a focus change of the FlutterView with ID
viewId
.inherited -
resetBrieflyShowPassword(
) → void - Resets brieflyShowPassword to the default value for the platform.
-
resetInitialLifecycleState(
) → void - Resets initialLifecycleState to the default value for the platform.
-
resetSupportsShowingSystemContextMenu(
) → void - Resets supportsShowingSystemContextMenu to the default value.
-
resetSystemFontFamily(
) → void - Resets systemFontFamily to the default for the platform.
-
scaleFontSize(
double unscaledFontSize) → double -
Computes the scaled font size from the given
unscaledFontSize
, according to the user's platform preferences.inherited -
scheduleFrame(
) → void -
Requests that, at the next appropriate opportunity, the onBeginFrame and
onDrawFrame callbacks be invoked.
override
-
scheduleWarmUpFrame(
{required VoidCallback beginFrame, required VoidCallback drawFrame}) → void -
Schedule a frame to run as soon as possible, rather than waiting for the
engine to request a frame in response to a system "Vsync" signal.
inherited
-
sendPlatformMessage(
String name, ByteData? data, PlatformMessageResponseCallback? callback) → void -
Sends a message to a platform-specific plugin.
override
-
sendPortPlatformMessage(
String name, ByteData? data, int identifier, SendPort port) → void -
Sends a message to a platform-specific plugin via a SendPort.
inherited
-
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
-
view(
{required int id}) → FlutterView? -
Returns the FlutterView with the provided ID if one exists, or null
otherwise.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited