nonNull<R> method

FutureOr<R?> nonNull<R>(
  1. FutureOr<R> block(
    1. T nonNullValue
    )
)

Implementation

FutureOr<R?> nonNull<R>(FutureOr<R> block(T nonNullValue)) {
  final self = this;
  if (self is Future<T?>) {
    return self.then((nonNull) {
      return nonNull == null ? null : block(nonNull);
    });
  } else {
    final v = this as T?;
    return v == null ? null : block(v);
  }
}