beBlank method

StringAssertions beBlank()

Asserts that a string is either '' or white space

Implementation

StringAssertions beBlank() {
  final trimmed = subject!.trim();
  if (isReversed) {
    if (trimmed.isEmpty) {
      throw ShouldlyTestFailureError(
        '\n$subjectLabel\n    `$subject`\nshould not be blank\n    but does',
      );
    }
    return StringAssertions(subject);
  } else {
    if (trimmed.isNotEmpty) {
      throw ShouldlyTestFailureError(
        '\n$subjectLabel\n    `$subject`\nshould be blank\n    but does not',
      );
    }
  }

  return StringAssertions(subject, isReversed: isReversed);
}