Sorting Lists in Dart and Flutter (5 Examples)

April 9, 2021 Pennywise

In this article, we’ll walk through a couple of examples of sorting lists in Dart (and Flutter as well), a common task that you may have to deal with in the majority of your projects. The…

Flutter & Dart: Get File Name and Extension from Path/URL

April 2, 2021 Pennywise

This article shows you how to retrieve the name and extension of a file from a file path or a web URL in Dart (and Flutter as well). In order to get the job done, we…

How to check your Flutter and Dart versions

March 31, 2021 A Goodman

This short article is about checking Flutter SDK and Dart SDK versions that are installed on your computer. In addition, you’ll also learn how to upgrade your Flutter SDK, find out which Flutter channel is being…

Understanding Typedefs (Type Aliases) in Dart and Flutter

March 30, 2021 Pennywise

Flutter and Dart have gotten better and more popular recently. Many new features and improvements have been added. In this article, we’ll explore typedefs in Dart (also known as type aliases) and go through a few…

2 ways to remove duplicate items from a list in Dart

December 3, 2020 A Goodman

This article shows you 2 approaches to remove duplicate items from a list in Flutter. The first one works well for a list of primitive data types. The second one is a little bit more complex…

How to remove items from a list in Dart

November 23, 2020 A Goodman

One of the most common tasks you encounter while working with a list in Dart is removing its items. Similar to various programming languages, Dart has some built-in functions that help us get this matter done…

Dart regex to validate US/CA phone numbers

November 19, 2020 A Goodman

Validating phone numbers is a common task when making Flutter applications. Before sending an SMS with a verification code (that usually costs real money), we should implement some basic checks. In this article, we’ll use a…

How to check numeric strings in Flutter and Dart

November 11, 2020 A Goodman

A numeric string is just a number in string format. Examples of numeric strings: To check whether a string is a numeric string, you can use the double.tryParse() method. If the return equals null then the…

Dart regular expression to check people’s names

November 11, 2020 A Goodman

Examples of human names: This is a simple regex pattern to check a person’s name in Dart: Test it: Result:

Base64 encoding and decoding in Dart (and Flutter)

November 11, 2020 A Goodman

To encode or decode Base64 in Dart, you can use dart:convert: For base64 decoding, use one of these 2 methods: String base64.encode(List<int> bytes) String base64Encode(List<int> bytes) For base64 decoding, use one of the following methods: Uint8List…

How to clone a List or Map in Flutter/Dart (4 methods)

November 10, 2020 A Goodman

There’re several ways to deep copy a list or map in Dart. Using json.decode() and json.encode() This approach works in any scenario (nested lists, nested maps…). You can actually clone multi-dimensional lists and maps without references….

2 ways to convert DateTime to time ago in Flutter

November 10, 2020 A Goodman

This article shows you 2 approaches to convert DateTime to time ago format in Flutter (and Dart too), for example, 5 minutes ago, 1 day ago, 2 days ago… The first one is using the difference()…

1 2 3