The assert statement is used for debugging purposes. It checks that a given condition is true at runtime. If the condition is false, it throws an exception, halting program execution.

void main() {
  int x = 10;

  assert(x == 10); // This will pass

  x = 20;
  assert(x == 10); // This will trigger an AssertionError and halt execution
}