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. [...]
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. [...]
DeltaTextInputClient
An interface to receive granular information from TextInput. [...]
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. [...]
HardwareKeyboard
Manages key events from hardware keyboards. [...]
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. [...]
KeyboardLockMode
Represents a lock mode of a keyboard, such as KeyboardLockMode.capsLock. [...]
KeyDownEvent
An event indicating that the user has pressed a key down on the keyboard. [...]
KeyEvent
Defines the interface for keyboard key events. [...]
KeyEventManager
A singleton class that processes key messages from the platform and dispatches converted messages accordingly. [...]
KeyHelper
Abstract class for window-specific key mappings. [...]
KeyMessage
The assumbled information corresponding to a native key message. [...]
KeyRepeatEvent
An event indicating that the user has been holding a key on the keyboard and causing repeated events. [...]
KeyUpEvent
An event indicating that the user has released a key on the keyboard. [...]
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 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. [...]
TextEditingDelta
A structure representing a granular change that has occurred to the editing state as a result of text editing. [...]
TextEditingDeltaDeletion
A structure representing the deletion of a single/or contiguous sequence of characters in an editing state.
TextEditingDeltaInsertion
A structure representing an insertion of a single/or contigous sequence of characters at some offset of an editing state.
TextEditingDeltaNonTextUpdate
A structure representing changes to the selection and/or composing regions of an editing state and no changes to the text value.
TextEditingDeltaReplacement
A structure representing a replacement of a range of characters with a new sequence of text.
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. [...]
TextLayoutMetrics
A read-only interface for accessing visual information about the implementing text.
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. [...]

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, provided for toolbar or shortcut keys.

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>{144 : LogicalKeyboardKey.numpad0, 145 : LogicalKeyboardKey.numpad1, 146 : LogicalKeyboardKey.numpad2, 147 : LogicalKeyboardKey.numpad3, 148 : LogicalKeyboardKey.numpad4…
kAndroidToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps Android-specific key codes to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{3 : LogicalKeyboardKey.goHome, 4 : LogicalKeyboardKey.goBack, 5 : LogicalKeyboardKey.call, 6 : LogicalKeyboardKey.endCall, 7 : LogicalKeyboardKey.digit0, 8 : LogicalKey…
kAndroidToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps Android-specific scan codes to the matching PhysicalKeyboardKey.
<int, PhysicalKeyboardKey>{1 : PhysicalKeyboardKey.escape, 2 : PhysicalKeyboardKey.digit1, 3 : PhysicalKeyboardKey.digit2, 4 : PhysicalKeyboardKey.digit3, 5 : PhysicalKeyboardKey.digit4, 6 : Phy…
kFuchsiaToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps Fuchsia-specific IDs to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{0x1200000010 : LogicalKeyboardKey.hyper, 0x1200000011 : LogicalKeyboardKey.superKey, 0x1200000012 : LogicalKeyboardKey.fn, 0x1200000013 : LogicalKeyboardKey.fnLock, 0x1…
kFuchsiaToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps Fuchsia-specific USB HID Usage IDs to the matching PhysicalKeyboardKey.
<int, PhysicalKeyboardKey>{0x00000010 : PhysicalKeyboardKey.hyper, 0x00000011 : PhysicalKeyboardKey.superKey, 0x00000012 : PhysicalKeyboardKey.fn, 0x00000013 : PhysicalKeyboardKey.fnLock, 0x0000…
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>{320 : LogicalKeyboardKey.numpad0, 321 : LogicalKeyboardKey.numpad1, 322 : LogicalKeyboardKey.numpad2, 323 : LogicalKeyboardKey.numpad3, 324 : LogicalKeyboardKey.numpad4…
kGlfwToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps GLFW-specific key codes to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{32 : LogicalKeyboardKey.space, 39 : LogicalKeyboardKey.quote, 44 : LogicalKeyboardKey.comma, 45 : LogicalKeyboardKey.minus, 46 : LogicalKeyboardKey.period, 47 : Logical…
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>{65429 : LogicalKeyboardKey.numpad7, 65430 : LogicalKeyboardKey.numpad4, 65431 : LogicalKeyboardKey.numpad8, 65432 : LogicalKeyboardKey.numpad6, 65433 : LogicalKeyboardK…
kGtkToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps GTK-specific key codes to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{165 : LogicalKeyboardKey.intlYen, 64774 : LogicalKeyboardKey.eraseEof, 64782 : LogicalKeyboardKey.attn, 64789 : LogicalKeyboardKey.copy, 64790 : LogicalKeyboardKey.medi…
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>{0x00000054 : LogicalKeyboardKey.numpadDivide, 0x00000055 : LogicalKeyboardKey.numpadMultiply, 0x00000056 : LogicalKeyboardKey.numpadSubtract, 0x00000057 : LogicalKeyboa…
kIosToLogicalKey → const Map<int, LogicalKeyboardKey>
A map of iOS key codes presenting LogicalKeyboardKey. [...]
<int, LogicalKeyboardKey>{40 : LogicalKeyboardKey.enter, 41 : LogicalKeyboardKey.escape, 42 : LogicalKeyboardKey.backspace, 43 : LogicalKeyboardKey.tab, 57 : LogicalKeyboardKey.capsLock, 58 : Lo…
kIosToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps iOS-specific key code values representing PhysicalKeyboardKey. [...]
<int, PhysicalKeyboardKey>{0x00000000 : PhysicalKeyboardKey.usbReserved, 0x00000001 : PhysicalKeyboardKey.usbErrorRollOver, 0x00000002 : PhysicalKeyboardKey.usbPostFail, 0x00000003 : PhysicalKey…
kLinuxToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps XKB specific key code values representing PhysicalKeyboardKey.
<int, PhysicalKeyboardKey>{0x00000009 : PhysicalKeyboardKey.escape, 0x0000000a : PhysicalKeyboardKey.digit1, 0x0000000b : PhysicalKeyboardKey.digit2, 0x0000000c : PhysicalKeyboardKey.digit3, 0x0…
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>{0x00000040 : LogicalKeyboardKey.f17, 0x0000004f : LogicalKeyboardKey.f18, 0x00000050 : LogicalKeyboardKey.f19, 0x0000005a : LogicalKeyboardKey.f20, 0x00000060 : Logical…
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>{0x00000041 : LogicalKeyboardKey.numpadDecimal, 0x00000043 : LogicalKeyboardKey.numpadMultiply, 0x00000045 : LogicalKeyboardKey.numpadAdd, 0x0000004b : LogicalKeyboardKe…
kMacOsToLogicalKey → const Map<int, LogicalKeyboardKey>
A map of macOS key codes presenting LogicalKeyboardKey. [...]
<int, LogicalKeyboardKey>{36 : LogicalKeyboardKey.enter, 48 : LogicalKeyboardKey.tab, 51 : LogicalKeyboardKey.backspace, 53 : LogicalKeyboardKey.escape, 54 : LogicalKeyboardKey.metaRight, 55 : L…
kMacOsToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps macOS-specific key code values representing PhysicalKeyboardKey. [...]
<int, PhysicalKeyboardKey>{0x00000000 : PhysicalKeyboardKey.keyA, 0x00000001 : PhysicalKeyboardKey.keyS, 0x00000002 : PhysicalKeyboardKey.keyD, 0x00000003 : PhysicalKeyboardKey.keyF, 0x00000004 …
kWebLocationMap → const Map<String, List<LogicalKeyboardKey?>>
A map of Web KeyboardEvent keys which needs to be decided based on location, typically for numpad keys and modifier keys. Used to provide different key objects for keys like KEY_EQUALS and NUMPAD_EQUALS.
<String, List<LogicalKeyboardKey?>>{'*' : <LogicalKeyboardKey?>[LogicalKeyboardKey.asterisk, null, null, LogicalKeyboardKey.numpadMultiply], '+' : <LogicalKeyboard…
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>{'Numpad0' : LogicalKeyboardKey.numpad0, 'Numpad1' : LogicalKeyboardKey.numpad1, 'Numpad2' : LogicalKeyboardKey.numpad2, 'Numpad3' : L…
kWebToLogicalKey → const Map<String, LogicalKeyboardKey>
Maps Web KeyboardEvent codes to the matching LogicalKeyboardKey.
<String, LogicalKeyboardKey>{'AVRInput' : LogicalKeyboardKey.avrInput, 'AVRPower' : LogicalKeyboardKey.avrPower, 'Accel' : LogicalKeyboardKey.accel, 'Accept' : Lo…
kWebToPhysicalKey → const Map<String, PhysicalKeyboardKey>
Maps Web KeyboardEvent codes to the matching PhysicalKeyboardKey.
<String, PhysicalKeyboardKey>{'Abort' : PhysicalKeyboardKey.abort, 'Again' : PhysicalKeyboardKey.again, 'AltLeft' : PhysicalKeyboardKey.altLeft, 'AltRight' : Phys…
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>{96 : LogicalKeyboardKey.numpad0, 97 : LogicalKeyboardKey.numpad1, 98 : LogicalKeyboardKey.numpad2, 99 : LogicalKeyboardKey.numpad3, 100 : LogicalKeyboardKey.numpad4, 10…
kWindowsToLogicalKey → const Map<int, LogicalKeyboardKey>
Maps Windows KeyboardEvent codes to the matching LogicalKeyboardKey.
<int, LogicalKeyboardKey>{3 : LogicalKeyboardKey.cancel, 8 : LogicalKeyboardKey.backspace, 9 : LogicalKeyboardKey.tab, 12 : LogicalKeyboardKey.clear, 13 : LogicalKeyboardKey.enter, 16 : LogicalK…
kWindowsToPhysicalKey → const Map<int, PhysicalKeyboardKey>
Maps Windows KeyboardEvent codes to the matching PhysicalKeyboardKey.
<int, PhysicalKeyboardKey>{1 : PhysicalKeyboardKey.escape, 2 : PhysicalKeyboardKey.digit1, 3 : PhysicalKeyboardKey.digit2, 4 : PhysicalKeyboardKey.digit3, 5 : PhysicalKeyboardKey.digit4, 6 : Phy…

Properties

debugKeyEventSimulatorTransitModeOverride KeyDataTransitMode?
Override the transit mode with which key events are simulated. [...]
read / write
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

debugAssertAllServicesVarsUnset(String reason) bool
Returns true if none of the widget library debug variables have been changed. [...]
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). [...]
KeyDataTransitMode
The mode in which information of key messages is delivered. [...]
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. [...]
SystemUiMode
Describes different display configurations for both Android and iOS. [...]
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

KeyEventCallback = bool Function(KeyEvent event)
The signature for HardwareKeyboard.addHandler, a callback to to decide whether the entire framework handles a key event.
KeyMessageHandler = bool Function(KeyMessage message)
The signature for KeyEventManager.keyMessageHandler. [...]
MessageHandler = Future<ByteData?>? Function(ByteData? message)
A function which takes a platform message and asynchronously returns an encoded response.
PlatformViewCreatedCallback = void Function(int id)
Callback signature for when a platform view was created. [...]
PointerEnterEventListener = void Function(PointerEnterEvent event)
Signature for listening to PointerEnterEvent events. [...]
PointerExitEventListener = void Function(PointerExitEvent event)
Signature for listening to PointerExitEvent events. [...]
PointerHoverEventListener = void Function(PointerHoverEvent event)
Signature for listening to PointerHoverEvent events. [...]
PointTransformer = Offset Function(Offset position)
Converts a given point from the global coordinate system in logical pixels to the local coordinate system for a box. [...]
RawKeyEventHandler = bool Function(RawKeyEvent event)
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. [...]
SystemUiChangeCallback = Future<void> Function(bool systemOverlaysAreVisible)
Signature for listening to changes in the SystemUiMode. [...]
TextInputFormatFunction = TextEditingValue Function(TextEditingValue oldValue, TextEditingValue newValue)
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. [...]