Dart

Dart & Flutter: Convert String/Number to Byte Array (Byte List)

Updated: June 6, 2023 By: A Goodman

This concise article shows you how to convert a string or a number (integer or double) to a byte array (a list of bytes) in Dart (and Flutter as well). Converting a String into a Byte…

Flutter & Dart: Convert a String/Integer to Hex

Updated: June 5, 2023 By: A Goodman

This practical shows you how to convert a number (integer) or a string to a hexadecimal value in Dart (and Flutter as well). Turn a Number into Hex Calling the toRadixString() method with a radix of…

Flutter & Dart: Convert Strings to Binary

Updated: June 5, 2023 By: A Goodman

Binary is made up of 0s and 1s, arranged in a sequence, and can be of any length. This quick article will show you how to convert a given string into binary in Dart (and Flutter…

Dart: Get Strings from ASCII Codes and Vice Versa

Updated: April 27, 2023 By: 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

Updated: February 18, 2023 By: 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

Updated: February 17, 2023 By: 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

Updated: February 14, 2023 By: 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

Updated: February 14, 2023 By: 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)

Updated: February 14, 2023 By: 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

Updated: February 8, 2023 By: 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

Updated: August 22, 2022 By: 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

Updated: July 28, 2022 By: 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…

1 2 3 4 8