Skip to content
pubscout

flutter_launch_arguments

1.1.0, released 4 months ago by mylittlesuite.com

Retrieve Android and iOS launch arguments inside a Flutter app.

WASM-ready
$ flutter pub add flutter_launch_arguments
Source repository

What it does

A Flutter plugin that allows applications to retrieve launch arguments passed via platform-specific commands or tools like instrumentation tests. It provides methods to fetch strings, booleans, doubles, and integers as futures.

AI-written summary of version 1.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to pass configuration or arguments to your app when launching instrumentation tests.
  • You want to retrieve launch arguments on both Android and iOS that are not limited to runtime --dart-define parameters.

Skip it when

  • You only need standard compile-time constants like --dart-define.
  • You need complex inter-app communication beyond simple launch arguments.

Strengths

  • Simple API to fetch various primitive data types (string, bool, double, int).
  • Supports both Android and iOS platform launch arguments.

Weaknesses

  • Requires platform-specific commands or tooling (such as adb or simctl) to inject arguments upon launch.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
0

Not documented.

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

void main() {
  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  late final FlutterLaunchArguments _flutterLaunchArgumentsPlugin;

  @override
  void initState() {
    super.initState();
    _flutterLaunchArgumentsPlugin = FlutterLaunchArguments();
  }

  @override
  Widget build(BuildContext context) => MaterialApp(
        home: Scaffold(
          body: FutureBuilder<String?>(
            future: _flutterLaunchArgumentsPlugin.getString('foo'),
            builder: (context, snapshot) => Text('${snapshot.data}'),
          ),
        ),
      );
}

Alternatives

Packages that do the same job and could replace flutter_launch_arguments.

  • screen_retriever

    Read desktop screen size, work area, scale factor and cursor position on Windows, macOS and Linux.

  • flutter_udid

    Retrieve a persistent unique device identifier across app reinstalls on mobile and desktop.

  • appcheck

    Check if another app is installed, enabled, launch it, and list installed apps on Android/iOS.

  • installed_apps

    List installed apps on Android, get app details, launch, uninstall, and open settings.