## Dart: Get Strings from ASCII Codes and Vice Versa

ASCII stands for American Standard Code for Information Interchange, is a character encoding standard that uses a 7-bit binary code to represent 128 possible characters, including letters, digits, punctuation marks, and control codes. For example, the…

## Flutter & Dart: How to Trim Leading and Trailing Whitespace

When using your app, users may unintentionally include leading or trailing whitespace when inputting data, which can result in inconsistent data. Trimming the whitespace ensures that the data is consistent and easier to work with. In…

## Dart: 5 Ways to Calculate the Sum of a List

This practical, example-centric article walks you through 5 different approaches to calculating the sum of a list of numbers in Dart (and Flutter as well). No need to delay, let’s start right away and write some…

## Dart: How to Remove or Replace Substrings in a String

In Dart (and Flutter as well), you can replace one or multiple substrings in a parent string by using the following built-in methods: You can remove substrings from a string by replacing them with empty strings…

## Dart: Calculating Variance and Standard Deviation

Variance is a statistical measure that quantifies the amount of variability or spread in a set of data. It is calculated as the average of the squared differences from the mean of the data. Standard deviation…

## Dart: 2 Ways to Calculate the Power of a Number (Exponentiation)

This concise and code-focused article shows you 2 different ways to find the power of a given number in Dart. Using the pow() method The pow() method from the math library (a built-in library of Dart)…

## How to add/remove a duration to/from a date in Dart

In Dart (and Flutter), you can add or subtract a duration (days, hours, etc.) to or from a DateTime object by using the add() and subtract() methods, respectively. Here’re some real-world use cases of doing this:…

## Dart: Get Host, Path, and Query Params from a URL

In Dart, you can extract useful information from a given URL string by following the steps below: 1. Construct a Uri object from your URL string: 2. Now, you can get what you want through various…

## Dart: Calculating the Average of Data in a List

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…

## Flutter: How to Fully Print a Long String/List/Map

If you’re running a Flutter with an iOS simulator or an Android emulator by using the following command: Then you’ll notice that whenever you print out a long string, list, map, or JSON data to the…

## Dart: Sorting Entries of a Map by Its Values

Imagine your boss gives you a Dart map like so: And then, he asks you to sort the map in the ascending/descending order of the map’s values. How do you solve this problem to make him…

## How to Reverse/Shuffle a List in Dart

The two examples below show you how to reverse and shuffle a given list in Dart. Reversing a Dart list Reversing a list means changing the order of the elements in the list so that the…