Dart: Checking whether a Map is empty
Updated: Aug 19, 2022
In Dart, you can check if a given map is empty or not in several ways. The most convenient approaches are to use the isEmpty, isNotEmpty, or length properties. Example: // main.dart Map<String, dynamic> map1 = {'website':......
Dart: Calculating the Average of Data in a List
Updated: Jul 28, 2022
This practical, succinct article walks you through two examples of calculating the average of numerical data in a given list. The first example works with a simple list that contains only numbers, while the second one deals with a list......
Dart: Checking if a Map contains a given Key/Value
Updated: Jul 10, 2022
Dart provides us the tools to quickly and conveniently check whether a map contains a given key or value. These tools are the containsKey() method and containsValue() method. Example: // kindacode.com // create a sample......
Dart: How to Add new Key/Value Pairs to a Map
Updated: Jul 10, 2022
This concise, practical article shows you a few ways to add new key/value pairs to a given map in Dart (and Flutter as well). Using map[newKey] = newValue syntax Example: Map<String, dynamic> map = { 'key1': 'Dog', ......
Dart: How to Update a Map
Updated: Jul 10, 2022
This succinct, practical article shows you 3 ways to update a map in Dart (and Flutter as well). 1 – Using map[key] = [newValue] syntax This approach is straightforward and makes the code easy to read and......
Dart: How to remove specific Entries from a Map
Updated: Jul 10, 2022
In Dart, you can remove key/value pairs from a given map by using one of the following methods: remove(): Removes the entry associated with the provided key. No error will occur even if the provided key doesn’t......
Using Cascade Notation in Dart and Flutter
Updated: Jul 10, 2022
This short post walks you through a few examples of using the cascade notation (.., ?…) in Dart. What Is The Point? In Dart, cascades let you execute a sequence of operations on the same object. In other words, cascades......
← PreviousPage 8 of 8