protocol_handler icon indicating copy to clipboard operation
protocol_handler copied to clipboard

Closing windows application using windowManager.destroy() takes a lot more time when protocol_handler is included.

Open IvoB1987 opened this issue 1 year ago • 0 comments

I have a Flutter windows desktop application. And I use window_manager where I call windowManager.destroy() to close the application. The strange part is that when when I add protocol_handler to the pubspec file this closing takes some extra seconds in release builds. I don't even import protocol_handler in any of the dart files. I don't know if this is an error of window_manager or of protocol_handler but it seems weird that just the inclusion in the pubspec has impact on how the application behaves. Any idea why this is and if this needs fixing in this package? Here's a minimum reproducable example:

import 'package:flutter/material.dart';
import 'package:window_manager/window_manager.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await windowManager.ensureInitialized();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      body: Center(
        child: TextButton(
          child: const Text('Close'),
          onPressed: () => windowManager.destroy(),
        ),
      ),
    ));
  }
}

IvoB1987 avatar Mar 21 '24 11:03 IvoB1987