getValue<T> method

T getValue<T>(
  1. String key, {
  2. T? defaultValue,
})

Returns an instance of T or null if the command has the designed option

final int value = getValue<int>('key', defaultValue: 0);
final double value = getValue<double>('key', defaultValue: 0.0);
final String value = getValue<String?>('key', defaultValue: 'Hello World');

Implementation

T getValue<T>(String key, { T? defaultValue }) => params[key] ?? defaultValue as T;