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());
}