Closed
Description
Problem
On the master
channel, "raw" dart:ui
apps without widgets cannot be closed using the x
in the title bar:
- Windows - The window remains open
- macOS - The window closes, however, both the app and
flutter run
do not exit. Onstable
, the window, app, andflutter run
all exit. - Linux - First close attempt does nothing, second close attempt prints the error
** (layers:754): WARNING **: 10:07:23.518: Error returned from System.requestAppExit: Requested method is not implemented
and the app exits.
Background
#30735 allowed Flutter apps to listen to application exits using the System.exitApplication
handler registered by ServicesBinding
. This works as expected for Flutter apps that have widgets.
However, "raw" Flutter apps that use dart:ui
directly without widgets don't register a ServicesBinding
, and the System.exitApplication
handler is never registered. As a result, the embedder's application exit messages aren't processed and the app does not exit.
Reproduction
- Switch to the master channel
- Run the
hello_world
raw layer example on Windows or macOS:- cd
./flutter/examples/layers
- If on Windows:
flutter create --platforms=windows .
- If on Linux:
flutter create --platforms=linux .
flutter run ./raw/hello_world.dart
- cd
- Close the app using the
x
button on the app's title bar
The app should shutdown, however, it stays open.