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

This package provides a simple way to check if your application is already running. You can use this to prevent multiple instances of your application from running at the same time.

Flutter Single Instance #

Provides utilities for handiling single instancing in Flutter.

Platform Support
Android ⚠️
iOS ⚠️
Web ⚠️
macOS
Windows
Linux

✅ - Confirmed working.
⚠️ - Always reports as first instance.

Installation #

Add flutter_single_instance as a dependency in your pubspec.yaml file.

flutter pub add flutter_single_instance

MacOS #

Disable sandboxing in macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements files.

<key>com.apple.security.app-sandbox</key>
<false/>

Usage #

A simple usage example:

import 'package:flutter_single_instance/flutter_single_instance.dart';

main() async {
  WidgetsFlutterBinding.ensureInitialized();

  if(await FlutterSingleInstance().isFirstInstance()){
    runApp(MyApp());
  }else{
    print("App is already running");

    exit(0);
  }
}

Web and other unsupported platforms #

You can safely use this package in web and other unsupported platforms. It will always return true for isFirstInstance method.

5
likes
140
points
413
downloads

Publisher

verified publishernecode.it

Weekly Downloads

This package provides a simple way to check if your application is already running. You can use this to prevent multiple instances of your application from running at the same time.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, path_provider

More

Packages that depend on flutter_single_instance