Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quitting app on macos throws error #420

Closed
ujwalbasnet1 opened this issue Nov 21, 2023 · 5 comments
Closed

quitting app on macos throws error #420

ujwalbasnet1 opened this issue Nov 21, 2023 · 5 comments

Comments

@ujwalbasnet1
Copy link

flutter run -d macos
Launching lib/main.dart on macOS in debug mode...
Building macOS application...
2023-11-21 09:44:41.693 xcodebuild[32238:4521379] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00008103-000164463A40801E }
{ platform:macOS, arch:x86_64, id:00008103-000164463A40801E }
Syncing files to device macOS...                                    78ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on macOS is available at: http://127.0.0.1:56188/nB5DWYQ9jvg=/
The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:56188/nB5DWYQ9jvg=/
Lost connection to device.
embedder.cc (2562): 'FlutterPlatformMessageCreateResponseHandle' returned 'kInvalidArguments'. Engine handle was invalid.
2023-11-21 09:44:50.891 ui_test[32378:4521911] Failed to create a FlutterPlatformMessageResponseHandle (2)

Minimal code to reproduce:


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 StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with WindowListener {
  late AppLifecycleListener listener;

  @override
  void initState() {
    super.initState();

    windowManager.addListener(this);
    _initWindowManager();
  }

  @override
  void onWindowClose() async {
    bool isPreventClose = await windowManager.isPreventClose();

    if (isPreventClose) {
      windowManager.destroy();
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: Scaffold(appBar: AppBar()));
  }

  void _initWindowManager() async {
    await windowManager.setPreventClose(true);
    setState(() {});
  }

  @override
  void dispose() {
    listener.dispose();
    windowManager.removeListener(this);
    super.dispose();
  }
}

@damywise
Copy link
Contributor

non-issue

@ujwalbasnet1
Copy link
Author

@damywise can you explain in detail what you mean by non-issue?

was it not reproducible?

@damywise
Copy link
Contributor

damywise commented Nov 21, 2023

The error is not an issue, literally. There's no problem there. No side effects. It's normal. Happens all the time. Just ignore it.
Unless there's an unexpected problem/behavior which you haven't specified.

@IvoB1987
Copy link

see also flutter/flutter#138707

@lijy91
Copy link
Member

lijy91 commented May 18, 2024

It doesn't seem to be caused by window_manager.

see also flutter/flutter#138707

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants