ArgumentError.value constructor Null safety

ArgumentError.value(
  1. dynamic value,
  2. [String? name,
  3. dynamic message]
)

Creates error containing the invalid value.

A message is built by suffixing the message argument with the name argument (if provided) and the value. Example:

Invalid argument (foo): null

The name should match the argument name of the function, but if the function is a method implementing an interface, and its argument names differ from the interface, it might be more useful to use the interface method's argument name (or just rename arguments to match).

Implementation

@pragma("vm:entry-point")
ArgumentError.value(value, [this.name, this.message])
    : invalidValue = value,
      _hasValue = true;