v1.2.0
windows_single_instance
Windows アプリのインスタンスを1つに制限し、新しいインスタンスが開かれたときに既存のウィンドウを前面に表示します。
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());
}