platform constant
A JSON MethodChannel for invoking miscellaneous platform methods.
The following outgoing methods are defined for this channel (invoked using OptionalMethodChannel.invokeMethod):
-
Clipboard.setData
: Places the data from thetext
entry of the argument, which must be a Map, onto the system clipboard. See Clipboard.setData. -
Clipboard.getData
: Returns the data that has the format specified in the argument, a String, from the system clipboard. The only format currently supported istext/plain
(Clipboard.kTextPlain). The result is a Map with a single key,text
. See Clipboard.getData. -
HapticFeedback.vibrate
: Triggers a system-default haptic response. See HapticFeedback.vibrate. -
SystemSound.play
: Triggers a system audio effect. The argument must be a String describing the desired effect; currently onlyclick
is supported. See SystemSound.play. -
SystemChrome.setPreferredOrientations
: Informs the operating system of the desired orientation of the display. The argument is a List of values which are string representations of values of the DeviceOrientation enum. See SystemChrome.setPreferredOrientations. -
SystemChrome.setApplicationSwitcherDescription
: Informs the operating system of the desired label and color to be used to describe the application in any system-level application lists (e.g. application switchers). The argument is a Map with two keys,label
giving a String description, andprimaryColor
giving a 32 bit integer value (the lower eight bits being the blue channel, the next eight bits being the green channel, the next eight bits being the red channel, and the high eight bits being set, as from Color.value for an opaque color). TheprimaryColor
can also be zero to indicate that the system default should be used. See SystemChrome.setApplicationSwitcherDescription. -
SystemChrome.setEnabledSystemUIOverlays
: Specifies the set of system overlays to have visible when the application is running. The argument is a List of values which are string representations of values of the SystemUiOverlay enum. See SystemChrome.setEnabledSystemUIMode. SystemUiOverlays can only be configured individually when using SystemUiMode.manual. -
SystemChrome.setEnabledSystemUIMode
: Specifies the SystemUiMode for the application. The optionaloverlays
argument is a List of values which are string representations of values of the SystemUiOverlay enum when using SystemUiMode.manual. See SystemChrome.setEnabledSystemUIMode. -
SystemChrome.setSystemUIOverlayStyle
: Specifies whether system overlays (e.g. the status bar on Android or iOS) should belight
ordark
. The argument is one of those two strings. See SystemChrome.setSystemUIOverlayStyle. -
SystemNavigator.pop
: Tells the operating system to close the application, or the closest equivalent. See SystemNavigator.pop. -
System.exitApplication
: Tells the engine to send a request back to the application to request an application exit (usingSystem.requestAppExit
below), and if it is not canceled, to terminate the application using the platform UI toolkit's termination API.
The following incoming methods are defined for this channel (registered using MethodChannel.setMethodCallHandler):
-
SystemChrome.systemUIChange
: The user has changed the visibility of the system overlays. This is relevant when using SystemUiModes through SystemChrome.setEnabledSystemUIMode. See SystemChrome.setSystemUIChangeCallback to respond to this change in application state. -
System.requestAppExit
: The application has requested that it be terminated. See ServicesBinding.exitApplication. -
System.initializationComplete
: Indicate to the engine the initialization of a binding that may, among other tasks, register a handler for application exit attempts.
Calls to methods that are not implemented on the shell side are ignored (so it is safe to call methods when the relevant plugin might be missing).
Implementation
static const MethodChannel platform = OptionalMethodChannel(
'flutter/platform',
JSONMethodCodec(),
);