invariant function

void invariant(
  1. bool condition,
  2. String? message
)

Implementation

void invariant(bool condition, String? message) {
  final msg = '$_prefix: $message';
  if (condition) {
    return;
  } else if (message!.isNotEmpty) {
    throw Exception(msg);
  } else {
    throw Exception(_prefix);
  }
}