Posts by Devsheet

Read all articles posted by Devsheet programmers and content writers.

How to get current date in Flutter [Dart]

In this tutorial, we'll show you how to get the current date in Flutter using the DateTime class. We'll also show you how to format the date and time to your liking.

Stop a Loop condition based in Dart

We will show different examples of Loops in Dart to stop the further iteration if a condition is matched. And also explain the alternatives that can be used to stop iterations condition-based.

Foreach Loop in Flutter [Dart]

In this post, we will learn to use ItearbleItem.forEach() function to iterate over a collection in Dart. There is no default foreach loop in Dart like other programming languages but it provides forEach() function that can be used for the same purpose.

Loop through a List in Flutter [Dart]

To access list items in Flutter or dart, we can use the index of the item. But if you want to iterate over the list, you can use the code examples explained in this article.

Delete item from a List in Flutter [Dart]

Lists are mutable collections in Flutter or Dart. If you are using Lists then you can add or remove items from them using Dart's in-built function. In this post, we are going to learn different methods that can be used to remove one or multiple elements f

Remove empty lists from a list of lists and flatten it using Dart

If you have a list created using Dart and it contains multiple lists inside it. Some of the lists contain no items and you want to get rid of those empty lists along with flattening the list. We are explaining the methods in Dart to do it.

Check if a String is empty or null in Dart / Flutter

In this post, we are going to explain how to check if a String is empty or not. We will also cover if the given value is null, false, or 0. If you are using Dart or Flutter to create your application, you can use the code examples listed here.

Remove empty and falsey values from a List in Dart/Flutter

If you have a list created in Dart and the list contains empty, null, or falsey values and you want to remove them from the list then the code examples explained in this post can be helpful.

Dart program to capitalize the first letter of a string

In a Dart program, String can be converted to uppercase or lowercase using inbuilt functions toUpperCase() and toLowerCase(). If you want to capitalize the first letter of the Dart String then you can use the below code.

Sort a list in ascending and descending order Dart or Flutter

We can use sort() function of Dart to sort a list in ascending and descending order.

Reverse a list in Flutter or Dart

If you want to reverse a list in Dart or Flutter, you can use List.reversed.toList() and it will reorder all the elements of the list in reversed order.

Check if list is empty in Flutter/Dart

In Dart and Flutter, checking if a list is empty is a common operation. There are a few different ways to do this, but the most common is to use the isEmpty method. This method will return true if the list is empty, and false if the list is not empty.

Dart program to remove duplicate items from a list

If you are using dart or flutter to develop your application and want to remove the same items from the list then you can use one of these methods explained in this post.

Add item at first position of list dart

You can use List.insert() method to insert an item at 0 index of the list. We need to pass the index and the item as a parameter to the List.insert() method.

Get the length of list in Dart

To get the length of a List in the dart programming language, you can use List.length and this will return the total number of items in the list.

Convert string to integer Dart Program

We can use int.parse() method in dart programming language to convert a string to the integer type.

Dart Program to convert a number to string

To convert a number or integer value to string format - dart method .toString() can be used.

For loop in Dart

For loop in Dart is used to iterate through dart collections. Different loops examples are explained in this code snippet.

Dart Program to remove multiple items from a List at once

If you want to delete multiple elements from a list with one line of code then you can use the .removeRange() method of Dart.

Remove List item or element using its index in Dart

If you know the index of a list element and you want to remove it from the list you can use the removeAt() method of Dart.

Dart Program to remove the last element from a List

To remove the last item or element from a list using Dart - you can use the .removeLast() method.

Dart program for condition based item removal from a list

If you want to remove items from a list based on one or multiple conditions then you can use the .removeWhere() method of dart list.

Dart Program to update or replace List items or values

To update list items of a list collection in dart you can use the index value of the list starts from 0 or the .replaceRange() method.

Dart Program to add Single or Multiple Items to a List

You can use .add() method to add single item to a list and .addAll() method to add multiple items to a list in Dart programming language.

Dart Collections - Create a List or Array

In dart, List is a collection of one or more items that can be accessed using index.

Assign a value to a variable if it is null using Dart

We can use null check operators in dart to assign a value to a variable. Here we are using ??= to check null values.

String interpolation and formation in Dart

You can perform string interpolation and formation in dart language using ${expression}. We can perform a lot of string operations using this.

Dart Program to generate unique id using uuid package

To generate unique id using dart programming language you can use dart package - uuid. The installation and usage examples are described in this code snippet

Loading more...
Search all posts...