checkNotNull<T> function

T checkNotNull <T>(
  1. T reference,
  2. {dynamic message}
)

Throws an ArgumentError if the given reference is null. Otherwise, returns the reference parameter.

Users of Dart SDK 2.1 or later should prefer ArgumentError.checkNotNull.

Implementation

T checkNotNull<T>(T reference, {message}) {
  if (reference == null) {
    throw ArgumentError(_resolveMessage(message, 'null pointer'));
  }
  return reference;
}