required<V> method

  1. @nonVirtual
V required<V>(
  1. V value,
  2. String name, {
  3. Kind<V>? kind,
  4. Kind? superKind,
  5. String? jsonName,
  6. List<Trait> tags = const [],
})

Maps a required named parameter of a constructor.

Parameter value is the mapped value.

Parameter name is the name of the named parameter.

Optional parameter kind is the kind of the value. If omitted, the kind is inferred from V and value using Kind.find.

Optional parameter defaultConstant is the default value.

Optional parameter tags is a list Trait instances such as ProtobufFieldTag.

Example

See ImmutableKind.

Implementation

@nonVirtual
V required<V>(
  V value,
  String name, {
  Kind<V>? kind,
  Kind? superKind,
  String? jsonName,
  List<Trait> tags = const [],
}) {
  if (kind != null && superKind != null) {
    throw ArgumentError.value(
      superKind,
      'superKind',
      'Must be null if kind is not null',
    );
  }
  return handle<V>(
    parameterType: ParameterType.requiredNamed,
    value: value,
    name: name,
    kind: kind ?? superKind,
    jsonName: jsonName,
    tags: tags,
  );
}