ArgumentError.value(value, [ String name, 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).

Source

ArgumentError.value(value, [this.name, this.message])
    : invalidValue = value,
      _hasValue = true;