Flutter: 2 Ways to Compare 2 Deep Nested Maps
In most programming languages, 2 maps are considered equal if they have the same length, and contain the same keys associated with the same values. This article shows you 2 different ways to correctly compare 2…
Dart: Converting a List to a Map and Vice Versa
In this article, we will go over a couple of different ways to convert a list to a map as well as turn a map into a list in Dart. Without any further ado, let’s dive…
Dart: Checking whether a Map is empty
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: Output: We’ve traversed an example that…
Dart: Checking if a Map contains a given Key/Value
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: Output: Further reading: Dart: How to Add…
Dart: How to Add new Key/Value Pairs to a Map
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: Output: Using addAll() method This method…
Dart: How to Update a Map
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…
Dart: How to remove specific Entries from a Map
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…
Flutter: Make a Widget Fill Remaining Space of Row/Column
In Flutter, you can make a widget fill up the remaining space of a Row or Column by wrapping it inside an Expanded or a Flexible widget. Example Preview: In this example, the amber box will…
Using Cascade Notation in Dart and Flutter
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….
Flutter: Add a Search Field to an App Bar (2 Approaches)
This article walks you through a couple of examples of adding a search field to an app bar in Flutter. The first one uses the AppBar widget (most seen in entertainment apps) and the second one…
Flutter: ListView Pagination (Load More) Example (updated)
In real-world Flutter applications, we often load dynamic data from servers or databases instead of using hardcode/dummy data as we often see in online examples. For instance, you have an e-commerce app and need to load…
Flutter Gradient Text Examples
This concise, practical article will walk you through three complete examples of creating gradient text in Flutter. We’ll use only the built-in features of Flutter and won’t rely on any third-party libraries. Example 1: Linear Gradient…