Kinda Code
Home/Dart

Dart

Dart: 2 Ways to Convert an Object to JSON

Dart: 2 Ways to Convert an Object to JSON

Updated: Sep 17, 2023
This succinct, straight-to-the-point article will walk you through a couple of different ways to turn an object (class instance) to JSON in Dart (and Flutter as well). Let’s begin! Using self-written code This approach......
Dart Map.putIfAbsent() method (explained with examples)

Dart Map.putIfAbsent() method (explained with examples)

Updated: Sep 17, 2023
This concise article is about the Map.putIfAbsent() method in the Dart programming language. The Fundamentals The purpose of the Map.putIfAbsent() method is to look up the value of a key in a map or add a new entry if it isn’t......
How to Merge 2 Maps in Dart (3 Approaches)

How to Merge 2 Maps in Dart (3 Approaches)

Updated: Sep 16, 2023
When working with Dart and Flutter, there might be times when you need to merge two maps, such as: You may want to combine two maps that contain different properties of the same object. For instance, you may have a map that stores......
Dart:  2 Ways to Find Common Elements of 2 Lists

Dart: 2 Ways to Find Common Elements of 2 Lists

Updated: Sep 15, 2023
Common (mutual) elements of two lists are the values or items that exist in both lists, appearing in each list at least once. These elements are shared or overlapping between the two lists. This succinct, example-based article will walk......
Dart: Remove Consecutive White Spaces from a String (3 Ways)

Dart: Remove Consecutive White Spaces from a String (3 Ways)

Updated: Sep 15, 2023
Consecutive white spaces in a string are multiple continuous spaces, tabs, or other whitespace characters appearing one after the other without any non-whitespace characters in between. In the vast majority of cases, you’ll only......
Dart map() Method: Explained with Examples

Dart map() Method: Explained with Examples

Updated: Sep 15, 2023
A Brief Overview In Dart (and Flutter), the map() method is used to transform each element of an iterable (such as a list, a set, or a map) into a new element according to a given function, and return a new iterable containing the......
Dart: How to Convert a List/Map into Bytes

Dart: How to Convert a List/Map into Bytes

Updated: Sep 15, 2023
Bytes are units of digital information that represent binary data. A byte consists of eight bits, which are either 0 or 1. This concise, example-based article will show you how to convert a list or a map into bytes in Dart (and Flutter......
Examples of using Future, async, await in Flutter

Examples of using Future, async, await in Flutter

Updated: Sep 14, 2023
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......
Using Switch-Case-Default in Dart & Flutter (4 Examples)

Using Switch-Case-Default in Dart & Flutter (4 Examples)

Updated: Sep 13, 2023
Overview In Dart and Flutter, the switch…case…default statement is used to avoid the long chain of the if-else statement. It is a simplified form of a nested if-else statement. The value of a variable is compared with multiple......
Using Try-Catch-Finally in Dart (3 examples)

Using Try-Catch-Finally in Dart (3 examples)

Updated: Sep 13, 2023
Overview In Dart and many other programming languages, the purpose of the try/catch/finally statement is to handle errors and exceptions that may occur during the execution of a program. Errors are problems that prevent the program......
6 Ways to iterate through a list in Dart and Flutter

6 Ways to iterate through a list in Dart and Flutter

Updated: Sep 11, 2023
Iterating through a list is an essential skill in programming because it allows you to access and manipulate each element of the list in a sequential manner. This straightforward, example-based article will walk you through several......
Using List.filled() in Dart and Flutter (with examples)

Using List.filled() in Dart and Flutter (with examples)

Updated: Sep 11, 2023
Overview In Dart and Flutter, the List.filled() constructor is used to create a fixed-length list of the given length, and initialize the value at each position with a given fill value. This can be helpful when you need to create a......
Page 1 of 8 Next →