# Dart

## Flutter & Dart: fold() method examples

Updated: August 5, 2023 By: Augustus

Some common use cases of the fold() method in Dart (and Flutter as well). Calculating the Sum of a List What this example does is simply find the sum of a given numeric list: Output: Finding…

## Flutter & Dart: every() method examples

Updated: February 6, 2023 By: Augustus

A few examples of using the every() method (of the Iterable class) in Dart (and Flutter as well). The purpose of this method is to check if every element of a given iterable satisfies one or…

## Flutter & Dart: reduce() examples

Updated: February 6, 2023 By: Augustus

In Dart, the reduce() method (of the Iterable class), as its name describes itself, executes a “reducer” callback function (provided by you) on each element of the collection, in order, passing in the return value from…

## Working with For loop in Dart (and Flutter)

Updated: February 6, 2023 By: Napoleon

The for loop is one of the most important features in many programming languages including Dart. 1. For-in syntax Example: Output: 2. A different syntax of the “for” loop in Dart Example: Output: Further reading: You…

## How to Merge 2 Lists in Dart

Updated: February 6, 2023 By: Hadrianus

This article shows you a couple of different ways to join 2 lists in Dart. You will learn each method through an example. Using Addition (+) Operator Example: Output: In my opinion, this approach is the…

## How to round a number in Dart

Updated: February 6, 2023 By: Hadrianus

In order to round a float number to an integer in Dart, we can use the round() method. This method returns the closest integer to the input number. If cannot determine the closest integer (e.g. 0.5,…

## Flutter/Dart: Generate Random Numbers between Min and Max

Updated: June 5, 2023 By: A Goodman

A couple of examples of generating a random integer within a given range in Dart (and Flutter as well). Example 1: Using Random().nextInt() method The code: Output: Due to the randomness, it’s very likely that you’ll…