TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
break statement is an unconditional control flow construct used to prematurely terminate the execution of the innermost enclosing loop (for, while, do-while) or switch statement. Upon execution, control is immediately transferred to the statement strictly following the terminated control structure, bypassing any remaining iterations or case blocks.
Syntax
Mechanics
Dart supports two variations of thebreak statement: unlabeled and labeled.
Unlabeled Break
When an unlabeledbreak is encountered, the Dart runtime halts the current iteration of the immediate enclosing loop and prevents any subsequent iterations. The loop’s condition is not evaluated again.
switch statement, break prevents fall-through by terminating the switch block after a matching case is executed. (Note: In Dart 3.0 and later, break is no longer strictly required at the end of non-empty case clauses, but it remains valid syntax).
Labeled Break
Dart allows loops to be prefixed with an identifier followed by a colon, creating a label. A labeledbreak statement explicitly specifies which enclosing loop to terminate. This is strictly utilized within nested loop architectures to bypass the default “innermost-only” termination rule, allowing a deeply nested block to terminate an outer loop.
Execution Rules
- A
breakstatement must be lexically enclosed by a loop orswitchstatement. - A labeled
breakmust reference a valid, enclosing label within the same function scope. It cannot be used to transfer control to arbitrary labels outside its lexical hierarchy (it is not agotostatement). - Executing a
breakdoes not execute the loop’s update statement (e.g., thei++in aforloop) for the terminated iteration.
Master Dart with Deep Grasping Methodology!Learn More





