verifyNotNull function

bool verifyNotNull(
  1. Object? value, [
  2. String? message
])

Verify that a value is not null.

Example:

verifyNotNull(result, 'Result should not be null');

Returns true if the verification passed, false otherwise.

Implementation

bool verifyNotNull(Object? value, [String? message]) {
  if (value == null) {
    final msg = message ?? 'Expected non-null value';
    _verificationFailures.add(msg);
    return false;
  }
  return true;
}