Flutter BottomAppBar: Tutorial & Examples
This article is about the BottomAppBar widget in Flutter. We’ll cover the fundamentals and walk through a couple of examples (from basics to advanced) of implementing and customizing the widget in practice (note that we’ll use…
Flutter: Rendering an Image from Byte Buffer/Int8List
In Flutter, you can render an image from an Int8List of bytes by using the Image.memory constructor like so: If what you have are byte buffers, use this: Example This example does the following things: Reading…
Adding a Border to an Image in Flutter (3 Examples)
This article shows you how to add a border to an image in Flutter. What is the point? To display an image in Flutter, we use the Image widget. However, it doesn’t ship a direct option…
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…
Dart: Calculate the Sum of all Values in a Map
This short example-based article shows you a few ways to find the sum of all values in a given map in Dart (presume that all the values are numbers). Using a For/In loop Example: Output: Using…
Flutter: 5 Ways to Add a Drop Shadow to a Widget
This practical article shows you a couple of different ways to add a drop shadow to a widget in Flutter. The first four approaches are to use self-written code while the last one is to make…
How to Reverse a String in Dart (3 Approaches)
The three examples below show you three different ways to reverse a given string in Dart (e.g. turn ABC to CBA). Turn the String into an Array Example: Output: Using StringBuffer Example: Output: Using Char Code…
Flutter: Create a New Project in the Current Directory
To create a new Flutter project in the current directory, you can run the flutter create command and use the dot (.) for the path: Important: The folder name should be all lowercase, with underscores to…
How to Subtract two Dates in Flutter & Dart
In Flutter and Dart, you can subtract two dates by using the DateTime.difference method. The result is a duration. Example: Output: If you want to get rid of the blue line under the print() function, you…
Flutter: Giving a Size to a CircularProgressIndicator
In Flutter, the CircularProgressIndicator widget, as its name implies, helps you implement a circle progress indicator that lets the user know that something is loading. This widget doesn’t ship options to set its size like width,…
Dart & Flutter: Convert a Duration to HH:mm:ss format
When working with Dart and Flutter, there might be cases where you want to turn a Duration into a string of HH:mm:ss format: Though Dart doesn’t provide an out-of-the-box API that can help us get the…