checkNotNull<T> function
Throws an ArgumentError if the given reference
is null
. Otherwise,
returns the reference
parameter.
Implementation
T checkNotNull<T>(T reference, [String? message]) {
if (reference == null) {
throw ArgumentError(message);
}
return reference;
}