throwUncheckedIf method

T throwUncheckedIf(
  1. bool condition(
    1. T value
    ), {
  2. required String prefix,
  3. ({String english, String locale}) message = (english: '', locale: ''),
  4. StackTrace? stackTrace,
})

특정 조건(condition)이 참일 경우 UncheckedError를 발생시킵니다.

프로그래머의 실수나 논리적 오류가 의심되는 치명적 상황에서 사용합니다. 시스템을 즉시 중단시키고 코드를 수정해야 하는 상황에 적합합니다.

Throws an UncheckedError if the specified condition is true. Used in critical situations where programmer mistakes or logical errors are suspected.

Implementation

T throwUncheckedIf(
  bool Function(T value) condition, {
  required String prefix,
  ({String english, String locale}) message = (english: '', locale: ''),
  StackTrace? stackTrace,
}) {
  if (condition(this)) {
    throw GenericUncheckedError(
      value: this,
      prefix: prefix,
      message: message,
      stackTrace: stackTrace ?? StackTrace.current,
    );
  }
  return this;
}