🛡️ Fork — Jeff Peiffer Legacy (jpl_)

Este paquete (jpl_launch_args) es un fork de launch_args, originalmente creado por Jeff Peiffer y archivado (read-only) junto con toda la org peiffer-innovations.

El prefijo jpl_ significa Jeff Peiffer Legacy: mantenemos vivo el legado de estos paquetes, bumpeados a las últimas versiones de Dart/Flutter, en el monorepo jpl.

Licencia original conservada. El crédito del diseño y la implementación original es de Jeff Peiffer.

I'm done

Table of Contents

launch_args

Table of Contents

Introduction

Flutter package to be able to get the args passed to an Android or iOS application. This plugin currently only supports Android and iOS as most other platforms provide the args to the main function directly.


Usage

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));
}

Passing Args

Android

adb

adb -s $DEVICE_ID shell am start \
  -n $ANDROID_PACKAGE/$ANDROID_ACTIVITY \
  -ez [arg name] [value] \
  -ez [arg name2] [value 2] \
  ...

Note: The arg names on android will be prefexed with -- to make it compatible with the options from the args package as Android always uses key / value pairs.

iOS

ios-deploy

$FLUTTER_HOME/bin/cache/artifacts/ios-deploy/ios-deploy --id $DEVICE_ID \
  --bundle build/ios/iphoneos/Runner.app \
  --debug \
  --args [arg name] [arg value] [arg name2] [arg value2] ...

Libraries

jpl_launch_args