$assert static method

void $assert(
  1. bool condition,
  2. String message, [
  3. List<String> env = const [],
  4. KareeErrorCode errorCode = KareeErrorCode.assertionError,
])

Karee assert function that will check a condition and if false will redirect to the Karee error screen with the provided message and environment.

Implementation

static void $assert(bool condition, String message,
    [List<String> env = const [],
    KareeErrorCode errorCode = KareeErrorCode.assertionError]) {
  if (!condition) {
    KareeRouter.goto(KareeConstants.kareeErrorPath, parameter: {
      #title: message,
      #stack: StackTrace.current,
      #env: env,
      #errorCode: errorCode
    });
  }
}