FLUTTER ECOSYSTEM

SongbookPro/flutter_windows_single_instance

SongbookPro/flutter_windows_single_instance open-source repository details.

Capa do projeto flutter_windows_single_instance
Stars
16
Forks
13
Último push (UTC)
16 de jun. de 2026
Status do projeto
Ativo
SongbookPro GitHub avatar
GITHUB Organization

SongbookPro ↗

LinguagensC++CMakeDartC

Pacotes publicados por este repositório

Dependências usadas

Lista de dependências 5 itens
  • flutter{"sdk":"flutter"}
  • win32>=6.0.0 <7.0.0
  • ffi>=1.0.0 <3.0.0
  • flutter_testDesenvolvimento{"sdk":"flutter"}
  • flutter_lintsDesenvolvimento^6.0.0

README original

Texto original em inglês. Visite o GitHub para a versão atual.

Expandir / recolher README

Windows Single Instance

Restrict a Windows app to only be able to open one instance at a time.

Installing

  1. Add WidgetsFlutterBinding.ensureInitialized(); to the start of your apps main function.
  2. Add the async modifier to your apps main function.
  3. Add a call to 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.

Example

void main(List<String> args) async {
    WidgetsFlutterBinding.ensureInitialized();
    await WindowsSingleInstance.ensureSingleInstance(
        args,
        "custom_identifier",
        onSecondWindow: (args) {
            print(args);
        });
    runApp(const MyApp());
}