platform constant

MethodChannel const platform

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 the text 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 is text/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 only click 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, and primaryColor 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). The primaryColor 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 optional overlays 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 be light or dark. 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 (using System.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):

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(),
);