Dart: Get Strings from ASCII Codes and Vice Versa

April 27, 2023 Snowball

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

February 18, 2023 Augustus

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

February 17, 2023 A Goodman

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

February 14, 2023 A Goodman

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

February 14, 2023 A Goodman

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)

February 14, 2023 A Goodman

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

February 8, 2023 A Goodman

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

August 22, 2022 Hadrianus

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

July 28, 2022 A Goodman

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

July 18, 2022 A Goodman

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

March 31, 2023 A Goodman

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

March 31, 2023 A Goodman

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…

1 2 3 7