Flutter

Flutter RotatedBox example

Updated: February 15, 2023 By: Augustus

The RotatedBox widget is used to rotate its child by an integral number of quarter turns. Usage: Example This sample app makes use of the RotatedBox widget to rotate the colored box blocks with text. Screenshot:…

Using the Opacity widget in Flutter (3 examples)

Updated: February 15, 2023 By: Napoleon

In Flutter, the Opacity widget is used to make its child partially or completely transparent. It can take a child widget and an opacity (a double) argument which determines the child’s alpha value. Example 1: Different…

How to implement a horizontal ListView in Flutter

Updated: February 15, 2023 By: Augustus

To make a horizontal ListView in Flutter, just set its scrollDirection property to Axis.horizontal, like this: Example 1 Preview: The code: Example 2: Using ListView.builder Preview: The code: Further reading: You can also check out our…

Working with Timer and Timer.periodic in Flutter

Updated: October 9, 2022 By: A Goodman

In this article, we’ll have a look at the fundamentals of the Timer class in Flutter and go over a couple of different examples of using it in applications. Overview Before using the TImer class, you…

How to convert String to DateTime in Flutter and Dart

Updated: February 14, 2023 By: Napoleon

Overview The DateTime class of the dart:core library provides 2 methods that can help you convert a string to DateTime: What Are Accepted Strings Not all strings can be converted to DateTime. A common pitfall that…

Flutter FutureBuilder example (updated)

Updated: June 5, 2023 By: A Goodman

This article shows you how to use the FutureBuilder widget in Flutter with a complete example. In simple words, the FutureBuilder widget displays one thing while your Flutter application is handling HTTP requests and reading local…

Set Default Parameter Values for a Function in Flutter

Updated: August 19, 2023 By: A Goodman

This is a short guide to default parameter values for a function in Flutter (and Dart as well). Default function parameters allow formal parameters to be initialized with default values if no value is passed. Syntax:…

Working with didChangeDependencies() in Flutter

Updated: January 30, 2023 By: Napoleon

In Flutter, didChangeDependencies() is called only a few moments after the state loads its dependencies. With this method, we can use context outside of build(). There’re several situations you need to call didChangeDependencies(). Below are a…

Flutter: Highlight selected items in a ListView

Updated: February 3, 2023 By: Augustus

Introduction When working with a ListView in Flutter that not only displays the list items but also allows the user to select one or more items from the list, it would be helpful if we render…

Flutter FormatException: Unexpected character (at character 1)

Updated: February 14, 2023 By: Guest Contributor

Problem When sending an HTTP request in Flutter, you may want to decode the JSON response. When doing so, you may encounter the following error: This error is caused by the wrong JSON format you get…

Flutter error: setState() called after dispose()

Updated: January 25, 2023 By: Hadrianus

This article is about a common error that you might encounter when building apps with Flutter. The Problem When working with Flutter, you may face this error: More information: Solutions You may notice that not only…

How to Iterate through a Map in Flutter & Dart

Updated: February 14, 2023 By: A Goodman

This succinct, practical article shows you 2 different ways to iterate through a map in Flutter and Dart. Using forEach Sample code: Output: Using for Sample code: Output: If you only want to iterate through map…

1 28 29 30 31 32 41