-
-
Notifications
You must be signed in to change notification settings - Fork 275
Open
Description
Having window_manager installed as a dependency breaks onExitRequested from Flutter's AppLifecycleListener.
Tested so far on Linux (Fedora 40 KDE, Wayland). Not sure of other platforms.
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
final windowService = WindowService();
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(
child: Text('Hello World!'),
),
),
);
}
}
class WindowService {
late final AppLifecycleListener _appLifecycleListener;
WindowService() {
_appLifecycleListener = AppLifecycleListener(
onExitRequested: _handleExitRequest,
);
}
Future<AppExitResponse> _handleExitRequest() async {
print('Exit requested');
return AppExitResponse.cancel;
}
}- Run the example, without
window_manageras a dependency - Try to close the window,
Exit requestedis printed instead of it closing (expected behaviour) - Add
window_manageras a dependency - Run the example again, and again try to close the window
- Instead of printing
Exit requested, the window closes with a messageLost connection to device.(unexpected behaviour)
Metadata
Metadata
Assignees
Labels
No labels