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

Flutter desktop application single instance plugin

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
  • Multi-language support (English, Korean, Custom)
  • Safe resource cleanup

Platform Support #

Windows macOS Linux
🚧 🚧

Getting Started #

Add flutter_alone to your pubspec.yaml:

dependencies:
  flutter_alone: ^1.1.0

Usage #

Import the package:

import 'package:flutter_alone/flutter_alone.dart';

Initialize in your main function:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  final messageConfig = MessageConfig(
    type: MessageType.en,  // Language selection
    showMessageBox: true,  // Message box display control
  );
  
  if (!await FlutterAlone.instance.checkAndRun(messageConfig: messageConfig)) {
    exit(0);  // Exit if another instance is running
  }
  
  runApp(const MyApp());
}

Clean up resources:

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

Additional Information #

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
2
likes
0
points
32
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter desktop application single instance plugin

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_alone

Packages that implement flutter_alone