option method

Object? option(
  1. String name
)

Returns the value of a named option (e.g., --name, --force).

Sugar over argResults![name]. Use the as cast or ?? default to get a typed value:

final name = option('name') as String? ?? 'World';
final force = option('force') as bool;

Implementation

Object? option(String name) => argResults![name];