checkNotNull<T> function

T checkNotNull<T>(
  1. T? value, {
  2. Any lazyMessage()?,
})

Throws an IllegalStateException with the result of calling lazyMessage if the value is null.

Otherwise returns the not null value.

Implementation

T checkNotNull<T>(T? value, {Any Function()? lazyMessage}) {
  if (value == null) throw Exception('IllegalStateException');
  return value;
}