/Dart 2

ArgumentError.value constructor

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


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

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.