defaultValue property

  1. @override
Object? get defaultValue
override

Returns the default value of an optional parameter.

Returns an InstanceMirror on the (compile-time constant) default value for an optional parameter. If no default value is declared, it defaults to null and a mirror of null is returned.

Returns null for a required parameter.

Required capabilities: defaultValue requires a DeclarationsCapability.

Implementation

@override
Object? get defaultValue {
  if (!_supportsDeclarations(_reflector)) {
    throw NoSuchCapabilityError(
      'Attempt to get `defaultValue` without `DeclarationsCapability`',
    );
  }
  return _defaultValue;
}