window_manager
window_manager copied to clipboard
Lost connection to device. (on ubuntu 22.04 LTS)
when i want to use window_manager package in my flutter app in ubuntu 22.04 os, i got this message:
Lost connection to device.
and suddenly the opened app windows close!
my code is here:
import 'package:get/get.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:window_manager/window_manager.dart';
import 'src/core/core.dart';
import 'src/view/view.dart';
void main() async {
// ====================== new ========================
WidgetsFlutterBinding.ensureInitialized();
await windowManager.ensureInitialized();
WindowOptions windowOptions = WindowOptions(
size: Size(800, 600),
center: true,
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.hidden,
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
//Set the fit size (Find your UI design, look at the dimensions of the device screen and fill it in,unit in dp)
return ScreenUtilInit(
designSize: designSize,
minTextAdapt: true,
splitScreenMode: true,
builder: (context, _) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
initialRoute: RoutesName.portConfigScreen,
getPages: AppPages.pages,
);
},
);
}
}
but if i comment this part, the app run healthy without setting my size properly:
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
})
and finally this is my flutter doctor result:
user@I1081:~/dev/work/with-ssh/panel$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.9, on Ubuntu 22.04.1 LTS 5.15.0-56-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.3)
[✓] VS Code
[✓] Connected device (2 available)
HTTP Host availability check is taking a long time...[✓] HTTP Host Availability
• No issues found!
try window_manager: 0.2.8
0.2.9 is crashy
0.2.9 wasn't released 2 weeks ago
I also encountered this problem Mainly because of the center property