How to Iterate through a Map in Flutter & Dart
This succinct, practical article shows you 2 different ways to iterate through a map in Flutter and Dart. Using forEach Sample code: Output: Using for Sample code: Output: If you only want to iterate through map…
Examples of using Future, async, await in Flutter
A few examples of using Future, async, and await in Flutter applications. Simple Example This example simply prints “Doing…” and “Task completed!” to the console. However, the first will appear before the later 2 seconds. The…
4 ways to convert Double to Int in Flutter & Dart
This succinct, practical article walks you through 4 common ways to convert a double to an integer in Flutter and Dart. Using toInt() The toInt() method will truncate a double to an integer and return a…
How to encode/decode JSON in Flutter
A Quick Note This article shows you how to encode/decode JSON in Flutter. The steps you need to follow are: 1. Import the dart:convert library: 2. Use: The concepts are just brief. Now, it’s time for…
How to make Comments in Flutter & Dart
This is a concise article about commenting in Flutter and Dart. Single-Line Comment (Format Comment) Just put two slash symbols at the beginning of the line you want to comment out. Multi-Line Comment (Block Comment) Syntax:…
Flutter & Dart: Check if a date is between 2 other dates
To check if a date is between 2 other ones in Flutter and Dart, you can use the isBefore() and isAfter() methods of the DateTime class. Example Output: You can find more information about the DateTime…
Flutter & Dart: ENUM Example
This article shows you how to use enumerations (also known as enums or enumerated types) in Dart and Flutter. Overview An enumeration in Dart is a set of symbolic names (members) bound to unique, constant values….
Flutter & Dart: Conditional remove elements from List
To remove elements from a list based on one or many conditions, you can use the built-in removeWhere() method. Example Let’s say we have a product list, and the task is to remove all products whose…
Flutter & Dart: Regular Expression Examples
A few examples of regular expression and the RegExp class in Flutter and Dart. Example 1: Email Validation The code: Output: Example 2: IP Addresses Validation The code: Output: Example 3: URL validation The code: Output:…
Flutter & Dart: fold() method examples
Some common use cases of the fold() method in Dart (and Flutter as well). Calculating the Sum of a List Output: Finding the biggest number (the maximum) in a List Output: Find the smallest number (the…
Flutter & Dart: every() method examples
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
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…