dart

Dart break statement explanation with example

break statement is used to stop the current execution. break is used with a switch block or with loops. With switch, we need to use one break statement at the end of each case block. Once a case block is executed, it goes out of that switch block.

Read

assert statement in Dart explanation with example

assert statements are useful for debugging a dart project. It is used mainly in development mode. assert takes one expression and checks if it is true or false. If it is true, the program runs normally and if it is false, it stops the execution and throws one error called AssertionError.

Read

Dart switch case with example

Switch is used to avoid if-else ladder in dart. The switch block takes one expression and each switch block takes n different case blocks. Based on the expression result, it moves to a specific case block. Dart switch block supports integer, string, compile-time constant and enumerated types.

Read

do...while loop in Dart with examples

do...while loop is similar to while loop. The only difference is that while loop checks the condition first and run a code block. But do...while loop runs the code block first and then it checks for the condition. If the condition is false, it stops.

Read

Dart optional positional, named and default parameters

Optional parameters in dart are used to mark any parameter optional i.e. you don't have to pass value for that parameter. You can pass one value if you have, but your choice is optional. Optional parameters are categorised into three types - positional, named, and default.

Read

Dart while loop explanation with example

Loops are used to run a piece of code for a finite amount of time. For loop and while loop are two mostly used loops. The syntax and idea of both of these loops are the same in almost all programming languages. while loop checks one condition and executes a block of code. It always checks the condition before starting the execution. It will keep running until the condition is true.

Read

5 Different ways in Dart to iterate through a Map

Dart map is used to hold key-value pairs. In this post, we will learn 5 different ways to iterate through a dart map with examples. Using loops and entries, we can iterate through a dart map key-value pairs.

Read

if-else condition in Dart explanation with example

if-else statements are control flow statements. Using these statements, you can control the flow of a dart program.

Read

Dart for loop with example

for loop is used to execute a piece of code for a specific amount of time. This amount of time is defined by a condition. It will keep executing the code until the condition is true.

Read

for-in loop in Dart with example

The for-in loop is similar to normal for loop. It is used to iterate through the elements of an iterable class like a list or set. Unlike the normal for loop, where we need to add one condition for any iteration, for in loop can iterate through the elements of an iterable without any specific condition. Like it doesn't need the length or any other variable to point to the current position.

Read