v1.2.0
windows_single_instance
Windows 앱의 단일 인스턴스를 강제로 실행하고, 새 인스턴스가 열릴 때 기존 창을 앞쪽으로 이동시킵니다.
55좋아요 1.9만30일 다운로드150Pub 점수
Windows
SongbookPro/flutter_windows_single_instance open-source repository details.
{"sdk":"flutter"}>=6.0.0 <7.0.0>=1.0.0 <3.0.0{"sdk":"flutter"}^6.0.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Restrict a Windows app to only be able to open one instance at a time.
WidgetsFlutterBinding.ensureInitialized(); to the start of your apps main function.async modifier to your apps main function.WindowsSingleInstance.ensureSingleInstance(), passing the apps startup args, a custom app string unique to your app (a-z, 0-9, _ and - only), and an optional callback function.void main(List<String> args) async {
WidgetsFlutterBinding.ensureInitialized();
await WindowsSingleInstance.ensureSingleInstance(
args,
"custom_identifier",
onSecondWindow: (args) {
print(args);
});
runApp(const MyApp());
}