launch_args 2.0.0 copy "launch_args: ^2.0.0" to clipboard
launch_args: ^2.0.0 copied to clipboard

outdated

Plugin to get command line launch args for both Android and iOS.

example/lib/main.dart

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

Future<void> main(List<String>? args) async {
  WidgetsFlutterBinding.ensureInitialized();
  args = args?.isNotEmpty == true ? args : (await LaunchArgs.args);

  runApp(MyApp(args: args));
}

class MyApp extends StatelessWidget {
  MyApp({this.args});

  final List<String>? args;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Launch Args'),
        ),
        body: ListView(
          children: [
            for (var arg in args ?? <String>['n/a'])
              ListTile(
                title: Text(arg),
              ),
          ],
        ),
      ),
    );
  }
}
1
likes
0
pub points
67%
popularity

Publisher

verified publisherpeifferinnovations.com

Plugin to get command line launch args for both Android and iOS.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, logging

More

Packages that depend on launch_args