notNull<T> static method

T notNull<T>(
  1. T object, [
  2. String message = DEFAULT_IS_NULL_EX_MESSAGE
])

Validate that the specified argument is not [null]; otherwise throwing an exception.

Validate.notNull(myObject, "The object must not be null");

The message of the exception is "The validated object is null".

object the object to check Returns the validated object if not null Throws ArgumentError if the object is null

Implementation

//    static dynamic notNull(final object,[String message = DEFAULT_IS_NULL_EX_MESSAGE]) {
//        if (object == null) {
//            throw new ArgumentError(message);
//        }
//        return object;
//    }

static T notNull<T>(final T object,
    [String message = DEFAULT_IS_NULL_EX_MESSAGE]) =>
    expect.notNull(object, message: () => message);