checkNotNull<T> function
Throws IllegalStateException if argument
is null
.
If name
is supplied, it is used as the parameter name
in the error message.
Returns the argument
if it is not null.
Implementation
T checkNotNull<T>(T argument, [String? message]) =>
argument ??
(throw IllegalStateException(message ?? 'Argument cannot be null'));