flutter_alone 1.1.1 copy "flutter_alone: ^1.1.1" to clipboard
flutter_alone: ^1.1.1 copied to clipboard

PlatformWindows

A Flutter plugin for preventing duplicate execution of desktop applications with customizable message support and cross-user detection

flutter_alone #

A robust Flutter plugin for preventing duplicate execution of desktop applications.

pub package

Features #

  • Prevent multiple instances of Windows desktop applications
  • Cross-user detection support
  • System-wide mutex management
  • Customizable message handling with template support
  • Multi-language support (English, Korean)
  • Safe resource cleanup

Platform Support #

Windows macOS Linux
🚧 🚧

Getting Started #

Add flutter_alone to your pubspec.yaml:

dependencies:
  flutter_alone: ^1.1.1

Usage #

Import the package:

import 'package:flutter_alone/flutter_alone.dart';

Basic usage with default English messages:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  if (!await FlutterAlone.instance.checkAndRun()) {  // Uses EnMessageConfig by default
    return;
  }
  
  runApp(const MyApp());
}

Using Korean messages:

if (!await FlutterAlone.instance.checkAndRun(
  messageConfig: const KoMessageConfig(),
)) {
  return;
}

Using custom messages with template:

final messageConfig = CustomMessageConfig(
  customTitle: 'App Running',
  messageTemplate: 'Application is already running by {domain}\\{userName}',
  showMessageBox: true,  // Optional, defaults to true
);

if (!await FlutterAlone.instance.checkAndRun(messageConfig: messageConfig)) {
  return;
}

Clean up resources:

@override
void dispose() {
  FlutterAlone.instance.dispose();
  super.dispose();
}

Additional Information #

Message Configuration #

The plugin provides three types of message configurations:

  • EnMessageConfig: Default English messages
  • KoMessageConfig: Korean messages
  • CustomMessageConfig: Custom messages with template support

Windows Implementation #

  • Uses Windows Named Mutex for system-wide instance detection
  • Implements cross-user detection through global mutex naming
  • Ensures proper cleanup of system resources
  • Proper Unicode support for all languages
2
likes
160
points
32
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for preventing duplicate execution of desktop applications with customizable message support and cross-user detection

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_alone

Packages that implement flutter_alone