handleRequestAppExit method

Future<AppExitResponse> handleRequestAppExit()
inherited

Handles any requests for application exit that may be received on the SystemChannels.platform method channel.

By default, returns ui.AppExitResponse.exit.

Not all exits are cancelable, so not all exits will call this function. Do not rely on this function as a place to save critical data, because you will be disappointed. There are a number of ways that the application can exit without letting the application know first: power can be unplugged, the battery removed, the application can be killed in a task manager or command line, or the device could have a rapid unplanned disassembly (i.e. it could explode). In all of those cases (and probably others), no notification will be given to the application that it is about to exit.

{@tool sample} This examples shows how an application can cancel (or not) OS requests for quitting an application. Currently this is only supported on macOS and Linux.

** See code in examples/api/lib/services/binding/handle_request_app_exit.0.dart ** {@end-tool}

See also:

Implementation

Future<ui.AppExitResponse> handleRequestAppExit() async {
  return ui.AppExitResponse.exit;
}