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

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_alone/flutter_alone.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final messageConfig = CustomMessageConfig(
    customTitle: 'Example App',
    messageTemplate: 'Application is already running by {domain}\\{userName}',
  );

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

  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void dispose() {
    FlutterAlone.instance.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Alone Example'),
        ),
        body: const Center(
          child:
              Text('The app ran normally with custom message configuration.'),
        ),
      ),
    );
  }
}
2
likes
160
points
35
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