services library Null safety

Platform services exposed to Flutter apps.

To use, import package:flutter/services.dart.

This library depends only on core Dart libraries and the foundation library.

Classes

AndroidMotionEvent
A Dart version of Android's MotionEvent. [...]
AndroidPointerCoords
Position information for an Android pointer. [...]
AndroidPointerProperties
Properties of an Android pointer. [...]
AndroidViewController
Controls an Android view. [...]
ApplicationSwitcherDescription
Specifies a description of the application that is pertinent to the embedder's application switcher (also known as "recent tasks") user interface. [...]
AssetBundle
A collection of resources used by the application. [...]
AutofillClient
An object that represents an autofillable input field in the autofill workflow. [...]
AutofillConfiguration
A collection of autofill related information that represents an AutofillClient. [...]
AutofillHints
A collection of commonly used autofill hint strings on different platforms. [...]
AutofillScope
An ordered group within which AutofillClients are logically connected. [...]
BasicMessageChannel<T>
A named channel for communicating with platform plugins using asynchronous message passing. [...]
BinaryCodec
MessageCodec with unencoded binary messages represented using ByteData. [...]
BinaryMessenger
A messenger which sends binary data across the Flutter platform barrier. [...]
BlacklistingTextInputFormatter
Old name for FilteringTextInputFormatter.deny.
ByteData
A fixed-length, random-access sequence of bytes that also provides random and unaligned access to the fixed-width integers and floating point numbers represented by those bytes. [...]
CachingAssetBundle
An AssetBundle that permanently caches string and structured resources that have been fetched. [...]
Clipboard
Utility methods for interacting with the system's clipboard.
ClipboardData
Data stored on the system clipboard. [...]
DeferredComponent
Manages the installation and loading of deferred components. [...]
EventChannel
A named channel for communicating with platform plugins using event streams. [...]
FilteringTextInputFormatter
A TextInputFormatter that prevents the insertion of characters matching (or not matching) a particular pattern. [...]
FontLoader
A class that enables the dynamic loading of fonts at runtime. [...]
GLFWKeyHelper
Helper class that uses GLFW-specific key mappings.
GtkKeyHelper
Helper class that uses GTK-specific key mappings.
HapticFeedback
Allows access to the haptic feedback interface on the device. [...]
JSONMessageCodec
MessageCodec with UTF-8 encoded JSON messages. [...]
JSONMethodCodec
MethodCodec with UTF-8 encoded JSON method calls and result envelopes. [...]
KeyboardKey
A base class for all keyboard key types. [...]
KeyHelper
Abstract class for window-specific key mappings. [...]
LengthLimitingTextInputFormatter
A TextInputFormatter that prevents the insertion of more characters than allowed. [...]
LogicalKeyboardKey
A class with static values that describe the keys that are returned from RawKeyEvent.logicalKey. [...]
MessageCodec<T>
A message encoding/decoding mechanism. [...]
MethodCall
An command object representing the invocation of a named method.
MethodChannel
A named channel for communicating with platform plugins using asynchronous method calls. [...]
MethodCodec
A codec for method calls and enveloped results. [...]
MouseCursor
An interface for mouse cursor definitions. [...]
MouseCursorManager
Maintains the state of mouse cursors and manages how cursors are searched for. [...]
MouseCursorSession
Manages the duration that a pointing device should display a specific mouse cursor. [...]
MouseTrackerAnnotation
The annotation object used to annotate regions that are interested in mouse movements. [...]
NetworkAssetBundle
An AssetBundle that loads resources over the network. [...]
OptionalMethodChannel
A MethodChannel that ignores missing platform plugins. [...]
PhysicalKeyboardKey
A class with static values that describe the keys that are returned from RawKeyEvent.physicalKey. [...]
PlatformAssetBundle
An AssetBundle that loads resources using platform messages.
PlatformViewController
An interface for a controlling a single platform view. [...]
PlatformViewsRegistry
A registry responsible for generating unique identifier for platform views. [...]
PlatformViewsService
Provides access to the platform views service. [...]
RawFloatingCursorPoint
The current state and position of the floating cursor.
RawKeyboard
An interface for listening to raw key events. [...]
RawKeyDownEvent
The user has pressed a key on the keyboard. [...]
RawKeyEvent
Defines the interface for raw key events. [...]
RawKeyEventData
Base class for platform-specific key event data. [...]
RawKeyEventDataAndroid
Platform-specific key event data for Android. [...]
RawKeyEventDataFuchsia
Platform-specific key event data for Fuchsia. [...]
RawKeyEventDataIos
Platform-specific key event data for iOS. [...]
RawKeyEventDataLinux
Platform-specific key event data for Linux. [...]
RawKeyEventDataMacOs
Platform-specific key event data for macOS. [...]
RawKeyEventDataWeb
Platform-specific key event data for Web. [...]
RawKeyEventDataWindows
Platform-specific key event data for Windows. [...]
RawKeyUpEvent
The user has released a key on the keyboard. [...]
RestorationBucket
A RestorationBucket holds pieces of the restoration data that a part of the application needs to restore its state. [...]
RestorationManager
Manages the restoration data in the framework and synchronizes it with the engine. [...]
StandardMessageCodec
MessageCodec using the Flutter standard binary encoding. [...]
StandardMethodCodec
MethodCodec using the Flutter standard binary encoding. [...]
StringCodec
MessageCodec with UTF-8 encoded String messages. [...]
SurfaceAndroidViewController
Controls an Android view by rendering to an AndroidViewSurface. [...]
SystemChannels
Platform channels used by the Flutter system.
SystemChrome
Controls specific aspects of the operating system's graphical interface and how it interacts with the application.
SystemMouseCursor
A mouse cursor that is natively supported on the platform that the application is running on. [...]
SystemMouseCursors
A collection of system MouseCursors. [...]
SystemNavigator
Controls specific aspects of the system navigation stack.
SystemSound
Provides access to the library of short system specific sounds for common tasks.
SystemUiOverlayStyle
Specifies a preference for the style of the system overlays. [...]
TextEditingValue
The current text, selection, and composing state for editing a run of text.
TextInput
An low-level interface to the system's text input control. [...]
TextInputClient
An interface to receive information from TextInput. [...]
TextInputConfiguration
Controls the visual appearance of the text input control. [...]
TextInputConnection
An interface for interacting with a text input control. [...]
TextInputFormatter
A TextInputFormatter can be optionally injected into an EditableText to provide as-you-type validation and formatting of the text being edited. [...]
TextInputType
The type of information for which to optimize the text input control. [...]
TextPosition
A position in a string of text. [...]
TextRange
A range of characters in a string of text.
TextSelection
A range of text that represents a selection.
TextureAndroidViewController
Controls an Android view that is rendered to a texture. [...]
UiKitViewController
Controls an iOS UIView. [...]
WhitelistingTextInputFormatter
Old name for FilteringTextInputFormatter.allow.

Mixins

AutofillScopeMixin
A partial implementation of AutofillScope. [...]
ServicesBinding
Listens for platform messages and directs them to the defaultBinaryMessenger. [...]
TextSelectionDelegate
A mixin for manipulating the selection, to be used by the implementer of the toolbar widget.

Constants

kAndroidNumPadMap → const Map<int, LogicalKeyboardKey>
A map of Android key codes which have printable representations, but appear on the number pad. Used to provide different key objects for keys like KEY_EQUALS and NUMPAD_EQUALS.
<int, LogicalKeyboardKey>{154 : LogicalKeyboardKey.numpadDivide, 155 : LogicalKeyboardKey.numpadMultiply, 156 : LogicalKeyboardKey.numpadSubtract, 157 : LogicalKeyboardKey.numpadAdd, 145 : Logic…
kAndroidToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps Android-specific key codes to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{0 : LogicalKeyboardKey.none, 223 : LogicalKeyboardKey.sleep, 224 : LogicalKeyboardKey.wakeUp, 29 : LogicalKeyboardKey.keyA, 30 : LogicalKeyboardKey.keyB, 31 : LogicalKe…
kAndroidToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps Android-specific scan codes to the matching PhysicalKeyboardKey.
<int, PhysicalKeyboardKey>{205 : PhysicalKeyboardKey.suspend, 142 : PhysicalKeyboardKey.sleep, 143 : PhysicalKeyboardKey.wakeUp, 30 : PhysicalKeyboardKey.keyA, 48 : PhysicalKeyboardKey.keyB, 46 …
kFuchsiaToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps Fuchsia-specific IDs to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{4294967296 : LogicalKeyboardKey.none, 4294967312 : LogicalKeyboardKey.hyper, 4294967313 : LogicalKeyboardKey.superKey, 4294967315 : LogicalKeyboardKey.fnLock, 429496731…
kFuchsiaToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps Fuchsia-specific USB HID Usage IDs to the matching PhysicalKeyboardKey.
<int, PhysicalKeyboardKey>{0 : PhysicalKeyboardKey.none, 16 : PhysicalKeyboardKey.hyper, 17 : PhysicalKeyboardKey.superKey, 19 : PhysicalKeyboardKey.fnLock, 20 : PhysicalKeyboardKey.suspend, 21 …
kGlfwNumpadMap → const Map<int, LogicalKeyboardKey>
A map of GLFW key codes which have printable representations, but appear on the number pad. Used to provide different key objects for keys like KEY_EQUALS and NUMPAD_EQUALS.
<int, LogicalKeyboardKey>{331 : LogicalKeyboardKey.numpadDivide, 332 : LogicalKeyboardKey.numpadMultiply, 334 : LogicalKeyboardKey.numpadAdd, 321 : LogicalKeyboardKey.numpad1, 322 : LogicalKeybo…
kGlfwToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps GLFW-specific key codes to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{65 : LogicalKeyboardKey.keyA, 66 : LogicalKeyboardKey.keyB, 67 : LogicalKeyboardKey.keyC, 68 : LogicalKeyboardKey.keyD, 69 : LogicalKeyboardKey.keyE, 70 : LogicalKeyboa…
kGtkNumpadMap → const Map<int, LogicalKeyboardKey>
A map of GTK key codes which have printable representations, but appear on the number pad. Used to provide different key objects for keys like KEY_EQUALS and NUMPAD_EQUALS.
<int, LogicalKeyboardKey>{65455 : LogicalKeyboardKey.numpadDivide, 65450 : LogicalKeyboardKey.numpadMultiply, 65453 : LogicalKeyboardKey.numpadSubtract, 65451 : LogicalKeyboardKey.numpadAdd, 654…
kGtkToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps GTK-specific key codes to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{65517 : LogicalKeyboardKey.hyper, 65518 : LogicalKeyboardKey.hyper, 65515 : LogicalKeyboardKey.superKey, 65516 : LogicalKeyboardKey.superKey, 269025191 : LogicalKeyboar…
kIosNumPadMap → const Map<int, LogicalKeyboardKey>
A map of iOS key codes which have printable representations, but appear on the number pad. Used to provide different key objects for keys like KEY_EQUALS and NUMPAD_EQUALS.
<int, LogicalKeyboardKey>{84 : LogicalKeyboardKey.numpadDivide, 85 : LogicalKeyboardKey.numpadMultiply, 86 : LogicalKeyboardKey.numpadSubtract, 87 : LogicalKeyboardKey.numpadAdd, 89 : LogicalKey…
kIosToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps iOS-specific key code values representing PhysicalKeyboardKey. [...]
<int, PhysicalKeyboardKey>{0 : PhysicalKeyboardKey.usbReserved, 1 : PhysicalKeyboardKey.usbErrorRollOver, 2 : PhysicalKeyboardKey.usbPostFail, 3 : PhysicalKeyboardKey.usbErrorUndefined, 4 : Phys…
kLinuxToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps XKB specific key code values representing PhysicalKeyboardKey.
<int, PhysicalKeyboardKey>{641 : PhysicalKeyboardKey.privacyScreenToggle, 150 : PhysicalKeyboardKey.sleep, 151 : PhysicalKeyboardKey.wakeUp, 235 : PhysicalKeyboardKey.displayToggleIntExt, 38 : P…
kMacOsFunctionKeyMap → const Map<int, LogicalKeyboardKey>
A map of macOS key codes which are numbered function keys, so that they can be excluded when asking "is the Fn modifier down?".
<int, LogicalKeyboardKey>{122 : LogicalKeyboardKey.f1, 120 : LogicalKeyboardKey.f2, 99 : LogicalKeyboardKey.f3, 118 : LogicalKeyboardKey.f4, 96 : LogicalKeyboardKey.f5, 97 : LogicalKeyboardKey.f…
kMacOsNumPadMap → const Map<int, LogicalKeyboardKey>
A map of macOS key codes which have printable representations, but appear on the number pad. Used to provide different key objects for keys like KEY_EQUALS and NUMPAD_EQUALS.
<int, LogicalKeyboardKey>{75 : LogicalKeyboardKey.numpadDivide, 67 : LogicalKeyboardKey.numpadMultiply, 78 : LogicalKeyboardKey.numpadSubtract, 69 : LogicalKeyboardKey.numpadAdd, 83 : LogicalKey…
kMacOsToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps macOS-specific key code values representing PhysicalKeyboardKey. [...]
<int, PhysicalKeyboardKey>{0 : PhysicalKeyboardKey.keyA, 11 : PhysicalKeyboardKey.keyB, 8 : PhysicalKeyboardKey.keyC, 2 : PhysicalKeyboardKey.keyD, 14 : PhysicalKeyboardKey.keyE, 3 : PhysicalKey…
kWebNumPadMap → const Map<String, LogicalKeyboardKey>
A map of Web KeyboardEvent codes which have printable representations, but appear on the number pad. Used to provide different key objects for keys like KEY_EQUALS and NUMPAD_EQUALS.
<String, LogicalKeyboardKey>{'NumpadDivide' : LogicalKeyboardKey.numpadDivide, 'NumpadMultiply' : LogicalKeyboardKey.numpadMultiply, 'NumpadSubtract' : LogicalKeyboardKey…
kWebToLogicalKey → const Map<String, LogicalKeyboardKey>
Maps Web KeyboardEvent codes to the matching LogicalKeyboardKey.
<String, LogicalKeyboardKey>{'None' : LogicalKeyboardKey.none, 'Hyper' : LogicalKeyboardKey.hyper, 'Super' : LogicalKeyboardKey.superKey, 'FnLock' : LogicalKeyboa…
kWebToPhysicalKey → const Map<String, PhysicalKeyboardKey>
Maps Web KeyboardEvent codes to the matching PhysicalKeyboardKey.
<String, PhysicalKeyboardKey>{'None' : PhysicalKeyboardKey.none, 'Hyper' : PhysicalKeyboardKey.hyper, 'Super' : PhysicalKeyboardKey.superKey, 'FnLock' : PhysicalK…
kWindowsNumPadMap → const Map<int, LogicalKeyboardKey>
A map of Windows KeyboardEvent codes which have printable representations, but appear on the number pad. Used to provide different key objects for keys like KEY_EQUALS and NUMPAD_EQUALS.
<int, LogicalKeyboardKey>{111 : LogicalKeyboardKey.numpadDivide, 106 : LogicalKeyboardKey.numpadMultiply, 109 : LogicalKeyboardKey.numpadSubtract, 107 : LogicalKeyboardKey.numpadAdd, 97 : Logica…
kWindowsToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps Windows KeyboardEvent codes to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{95 : LogicalKeyboardKey.sleep, 65 : LogicalKeyboardKey.keyA, 66 : LogicalKeyboardKey.keyB, 67 : LogicalKeyboardKey.keyC, 68 : LogicalKeyboardKey.keyD, 69 : LogicalKeybo…
kWindowsToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps Windows KeyboardEvent codes to the matching PhysicalKeyboardKey.
<int, PhysicalKeyboardKey>{57439 : PhysicalKeyboardKey.sleep, 57443 : PhysicalKeyboardKey.wakeUp, 255 : PhysicalKeyboardKey.usbErrorRollOver, 252 : PhysicalKeyboardKey.usbPostFail, 30 : Physical…

Properties

platformViewsRegistry PlatformViewsRegistry
The PlatformViewsRegistry responsible for generating unique identifiers for platform views.
final
rootBundle AssetBundle
The AssetBundle from which this application was loaded. [...]
final

Functions

debugIsSerializableForRestoration(Object? object) bool
Returns true when the provided object is serializable for state restoration. [...]

Enums

Brightness
Describes the contrast of a theme or color palette.
DeviceOrientation
Specifies a particular device orientation. [...]
FloatingCursorDragState
A floating cursor state the user has induced by force pressing an iOS keyboard.
KeyboardSide
An enum describing the side of the keyboard that a key is on, to allow discrimination between which key is pressed (e.g. the left or right SHIFT key). [...]
MaxLengthEnforcement
MaxLengthEnforcement.enforced versus [...]
ModifierKey
An enum describing the type of modifier key that is being pressed. [...]
SelectionChangedCause
Indicates what triggered the change in selected text (including changes to the cursor location).
SmartDashesType
Indicates how to handle the intelligent replacement of dashes in text input. [...]
SmartQuotesType
Indicates how to handle the intelligent replacement of quotes in text input. [...]
SystemSoundType
A sound provided by the system. [...]
SystemUiOverlay
Specifies a system overlay at a particular location. [...]
TextAffinity
A way to disambiguate a TextPosition when its offset could match two different locations in the rendered string. [...]
TextCapitalization
Configures how the platform keyboard will select an uppercase or lowercase keyboard. [...]
TextInputAction
An action the user has requested the text input control to perform. [...]

Typedefs

MessageHandler(ByteData? message) Future<ByteData?>?
A function which takes a platform message and asynchronously returns an encoded response.
PlatformViewCreatedCallback(int id) → void
Callback signature for when a platform view was created. [...]
PointerEnterEventListener(PointerEnterEvent event) → void
Signature for listening to PointerEnterEvent events. [...]
PointerExitEventListener(PointerExitEvent event) → void
Signature for listening to PointerExitEvent events. [...]
PointerHoverEventListener(PointerHoverEvent event) → void
Signature for listening to PointerHoverEvent events. [...]
PointTransformer(Offset position) Offset
Converts a given point from the global coordinate system in logical pixels to the local coordinate system for a box. [...]
RawKeyEventHandler(RawKeyEvent event) bool
A callback type used by RawKeyboard.keyEventHandler to send key events to a handler that can determine if the key has been handled or not. [...]
TextInputFormatFunction(TextEditingValue oldValue, TextEditingValue newValue) TextEditingValue
Function signature expected for creating custom TextInputFormatter shorthands via TextInputFormatter.withFunction.

Exceptions / Errors

MissingPluginException
Thrown to indicate that a platform interaction failed to find a handling plugin. [...]
PlatformException
Thrown to indicate that a platform interaction failed in the platform plugin. [...]