argparser 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 53

Argparser #

Argparser helps you parse command-line arguments and flags easily.

Usage #

Follow the instructions from to depend on the argparser package. Then argparser should be able to use as in the following examples.

// main.dart
import 'package:argparser/argparser.dart' as ap;

void main(List<String> args) {
  var arguments = ap.parse(args);

dart main.dart need -a --much=better -- example

// [need, example]
// {a: true, much: better}


parse(List<String> args, Options options) #


List of arguments strings, can be used directly from the main function argument.

List<String> options.boolean

List of keys for options that will be parsed as boolean values.

var output = ap.parse(['--for', 'sure'])
// output.primary -> []
// output.options -> {for: sure}

var output = ap.parse(
  ['--for', 'sure'],
    boolean: ['for']
// output.primary -> [sure]
// output.options -> {for: true}

List<List<String>> options.alias

List of lists with each of them containing alias keys for options.

var output = ap.parse(['--save'])
// output.primary -> []
// output.options -> {save: true}

var output = ap.parse(
    alias: [
      ['save', 's']
// output.primary -> []
// output.options -> {s: true, save: true}

Map<String, dynamic> options.defaults

Default values for options, which will be merged with the parsed output.

var output = ap.parse(['npm', 'i', 'react'])
// output.primary -> [npm, i, react]
// output.options -> {}

var output = ap.parse(
  ['npm', 'i', 'react'],
    defaults: {
      'save': true
// output.primary -> [npm, i, react]
// output.options -> {save: true}

License #

MIT © Frenco Jobs

0.0.1 #

  • Initial version


import 'package:argparser/argparser.dart' as ap;

void main(List<String> args) {
  var arguments = ap.parse(
    ap.Options(boolean: [], alias: [], defaults: {}),

  print('primary: ');
  print('options: ');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  argparser: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:argparser/argparser.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Health issues and suggestions

Document public APIs. (-1 points)

11 out of 11 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
Dev dependencies
pedantic ^1.8.0
test ^1.6.0