{

Learn free flutter tutorials


How to convert Double to Integer or Integer to double in Dart| Flutter By Example

March 12, 2023 ·  4 min read

This tutorial shows multiple ways to Convert Double to Int and Int to double in Dart and Flutter programming. Convert Double to Int in Dart: First Way, use double.toInt() method, For example: 3.4.toInt() returns int value 3. Second way, use double.truncate() method to remove decimals from a number.3.4.truncate() returns int value 3. Third way, use rounding methods such as round, ceil, and floor based on lower or upper value of a given number....


Perl How to: Find a Given Variable String is numeric or not

January 9, 2023 ·  2 min read

This tutorial explains How to check given string is a number or not in Perl with Code examples Scalar::Util module provides the qw(looks_like_number)function that checks given variable is a number or not. For example, looks_like_number("111") returns a boolean value, use in the conditional if statement to check as a number or not. Second, append a variable with zero, and use the result in a conditional if statement. Third, use the [Regexp::Common] module that uses a regular expression for real and integer numbers....


Dart| Flutter How to calculate the collection numbers sum example

February 28, 2022 ·  3 min read

Multiple ways to sum of numbers in Dart and flutter with examples List reduce method List fold method lists sum with primitive numbers Iterate list using map, and reduce to sum the object property The collection is a collection of elements in dart. For example, a List is one of the collections of items to store in insertion order. Dart Collection of the sum of numbers example There are multiple ways we can do the sum for the collection of numbers....


Dart| Flutter How to calculate the collection numbers sum example

February 28, 2022 ·  2 min read

Functions in Dart return only a single value. There are multiple ways to return multiple values wrapped with the below types Array or List Create an object of a Class Set Tuple class How to return multiple values from a Function in Dart Following are multiple ways to pass multiple data from a function create a class and pass the object with values from a function In this example, the function wants to return multiples of different types, So Wrap those values in the object of a class and return from a function....


Dart| Flutter How to check element exists in Array

February 28, 2022 ·  1 min read

This tutorial shows how to check if element exists in an array or list Dart or Flutter List In dart, Array, and List store the same type of collections, Arrays are fixed, and List is dynamic. Let’s see how to check if an element exists in an array or list. How do Check values exist in an Array or List of dart/flutters? dart list provides multiple ways to check the sub-list contains in the list of elements....


Dart| Flutter How to encode and decode a string base64 with example

February 28, 2022 ·  1 min read

Sometimes, need to send the string data in base64, So we need to know how to send encode a string and decode a string. There are multiple ways we can do it. Dart provides an inbuilt dart:convert library to encode and decode various objects in UTF8 formats. How to encode a string in base64 format in dart dart:convert library provides a base64 class. This example converts the string into an encoded base64 string....


Dart| Flutter How to get extension name and MIME type of a file with example

February 28, 2022 ·  2 min read

This tutorial explains about below program How to get the MIME type of a file How to find the extension of a given file How to get the MIME type of file? This program explains about to get mime types of a file. The mime package provides a lookupMimeType function, that returns the MIME type. It parses the path of a file, returns extension, extension is checked against MIME types, and returns the MIME-type...


Dart| Flutter How to get File name and extension with example

February 28, 2022 ·  1 min read

The post is about how to get the name of the file in dart programming. Dart gets filename and extension There are multiple ways to get the name of the file using path package basename Import path/path.dart package into your code. Path package provides basename and basenameWithoutExtension properties to get name and extension. First, Create a file object. Pass file.path to those methods. Here is an example import 'dart:io'; import 'package:path/path....


Dart| Flutter How to read an image from a disk and resize a file

February 28, 2022 ·  1 min read

Sometimes, We want to read an image from a disk folder and resize it and display the image. You can use the resized image in flutter widgets to display it This tutorial explains how to read and resize it. How to read images in dart? First import the image library as a dependency in pubspec.yaml name: dartapp description: >- dart example application. version: 1.0.0 environment: sdk: '>=2.10.0 <3.0.0' dependencies: image: any import dart:io and image package in the application create a File object with the given file path Decode the image using file object using decodeImage, and convert to a byte in synchronous operation using the readAsBytesSync() method change the image size with copyResize and returns the image object File convert image object, save the object Here is an example program for reading, resize, and outputting image...


Dart| Flutter How to reverse a string example

February 28, 2022 ·  2 min read

In this article, learn how to reverse a string in multiple ways. It also includes reversing a string with Unicode UTF-8 characters. There are multiple ways we can do it. Dart provides an inbuilt dart:convert library to encode and decode various objects in UTF8 formats. How to do string in reverse order in dart This example takes the input string and converts the string in reverse order. First, the Given string is split into characters using the split() method....


Dart| Flutter How to: Check List is empty or not Example

February 28, 2022 ·  2 min read

This tutorial shows multiple ways how to find if the list is empty or not in Dart or Flutter. This post talks about the below things. How to check if a given list length is zero Find list is empty or blank. Check List contains nil elements What is an empty list in dart? An empty list is a list with no elements and is blank. You can check another post, create an empty list in flutter...


Dart| Flutter How to: Check strings are equal or not Example

February 28, 2022 ·  2 min read

This tutorial shows how to compare whether two strings are equal or not Dart or Flutter. Dart does not provide the isEquals (java) method to compare methods for equality. `String equals compare the same characters in the order of both strings are equal. Since String is an immutable object, Once you create a string object, does not allow you to modify the string, however, if you append to an existing string, it creates a new string with the result, and the Original string also exists in memory....


Dart| Flutter How to: Check sublist contains all elements in List

February 28, 2022 ·  1 min read

This tutorial shows how to check if sublist exists in Dart or Flutter List How do Check sub lists exist in a list of dart/flutter? dart list provides multiple ways to check the sub-list contains in the list of elements. First Convert the list into a set using the Set.of() method Check sub-list exists in Set using the Set.containsAll() method Here is an example code void main() { var list = [1, 4, 5, 2, 8]; var sublist = [1, 4]; var set = Set....


Dart| Flutter How to: Check whether Map is empty or not Example

February 28, 2022 ·  3 min read

This tutorial shows different ways to check whether a map is empty or not in Dart or Flutter. This post talks about the below things. How to check if a given map is null or not and the length is zero Find whether the map is empty or blank. Check map contains no elements In dart, what is an empty map? An empty map has no elements and is blank....


Dart| Flutter How to: Convert Map to Query String with example

February 28, 2022 ·  2 min read

This tutorial, Shows you multiple ways to convert a Map of values into URL Query String and Query String into the map. This works in Flutter also. Convert Query String to Map, pass Map to queryParameters in the Uri constructor Convert Map to Query String using the Uri.splitQueryString() method Query String is a key and value appended to URL separated by &. How to Convert Map to Query String in dart and flutter Sometimes, We have a map of keys and values in the Dart...


Dart| Flutter How to: Convert String into an array

February 28, 2022 ·  1 min read

This tutorial shows multiple ways to convert a String into an array or list in dart and flutter programming. Split the string into a list of characters using the String.split() method remove whitespaces using the trim method, and split using split() method Since Array does not support Dart. We will show you to convert to List only. Convert String into a list of characters List or Array of character String....


Dart| Flutter How to: Create a private variable with example

February 28, 2022 ·  2 min read

This tutorial shows how to write and declare private variables in Dart. Dart Private Variables There is no private keyword or private variables in Dart. In dart, you can declare a variable name with an underscore(_) as a private variable. Private variables are accessed inside the same class, not outside the classes or files. In Dart, you can declare private variables in the classes class Employee { int _privateVariable = 0; int id = 11; displayMessage() { print('$_privateVariable'); // 0 print('$id'); // 11 } } void main() { Employee employee = Employee(); print(employee....


Dart| Flutter How to: Create an Empty List

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to create an empty list in Dart or Flutter List An empty list is a list without an element and the size of a list is zero. Sometimes, In Flutter, API or service method returns an empty list instead of null to have better handling of null safety. How to create an Empty List in Flutter or dart? An empty list can be created in multiple....


Dart| Flutter How to: Create an Empty Map

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to create an empty Map in Dart or Flutter An empty Map is a Map data structure that lacks a key and value pair of elements, and a Map has a length of zero. In Flutter, an API or service method may return an empty Map instead of a null to improve null safety handling. How to create an Empty Map in Flutter or dart?...


Dart| Flutter How to: Create an Empty Set

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to create an empty Set in Dart or Flutter An empty Set is a Set data structure that contains no elements, and a Set has a length of zero. In Flutter, an API or service method may return an empty set instead of a null to improve null safety handling. How to create an Empty Set in Flutter or dart? An empty Set can be created in multiple ways....


Dart| Flutter How to: Filter search a list with examples

February 28, 2022 ·  3 min read

This tutorial shows multiple examples of filtering List with some logic in Dart and flutter Dart/flutter multiple ways to filter a list or array of objects Following are multiple ways we can filter a list of objects In both the examples below, we have a list of objects, Where each object contains salary and name. Filter the list of objects based on salary conditions and output the result. using Where predicate The List....


Dart| Flutter How to: Find a Given String is numeric or not

February 28, 2022 ·  2 min read

This tutorial explains How to check given string is a number or not. You can check my previous post, on How to Convert String to Number in dart. Dart How to check whether a String is Numeric or not This approach uses the parse method of double for floating and number for without decimals The tryParse method converts the string literal into a number. You can also use the parse method....


Dart| Flutter How to: Find an object implements interface

February 28, 2022 ·  2 min read

In Dart, Class extends only one parent class and implements multiple interfaces. Below are operators to check a class of a given object. is checks a given object implements or extends interface or class, It checks parent class hierarchy and returns true if it follows inheritance. runtimeType: Returns the class of an object and gives the only current class of an object not the inheritance tree class checking if an object implements interface in dart?...


Dart| Flutter How to: Find Set is Empty or not

February 28, 2022 ·  3 min read

This tutorial shows different ways to determine whether or not a set is empty in Dart or Flutter. How to test whether a given Set is null or not and whether its length is zero. Determine whether the Set is empty or blank. Verify that the Set contains Zero elements A set is one of the data structures to store the collection of elements without duplicates. You can check another post, How to create an empty Set in flutter...


Dart| Flutter How to: Flatten a List with examples

February 28, 2022 ·  2 min read

List contains a list of sub-lists or a Map i.e two dimensions list. Flatten list is to output a single list from a two-dimension list. Let’s create a list of sub-list or two-dimensional lists in dart. var list = [ [1, 2, 3], [4, 5, 6], [7, 8] ]; A two-dimensional list contains a list of elements, where each element is again a list. After flatting the list, the result is...


Dart| Flutter How to: Function Return a function

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to execute a function repeatedly with a delay timer in dart and flutter programming. Functions declare a return type and return values. In Dart Function also returns functions, which means Function is also typing like primitive type. And type is Function. How to Return a function in Dart The below examples show that Functions return the Function type. Function Declaration contains Return type as Function....


Dart| Flutter How to: get First and Last Element from a List with Example

February 28, 2022 ·  3 min read

This tutorial shows how to get the first and last element from a Dart or Flutter List dart programming provides multiple ways to retrieve the first and last element from a list. How to get the First element in dart/flutter? dart list provides multiple ways to retrieve the first element. List.first property Returns the first element from a given list, if the list is not empty. if the list is empty, It throws an error Uncaught Error: Bad state: No element import 'dart:async'; void main() async { List list = []; print(list);//[] print(list....


Dart| Flutter How to: Insert an element at beginning of a List with Example

February 28, 2022 ·  1 min read

This tutorial shows how to insert the data at beginning of a list with examples in dart List inserts the elements in the insertion order. In the below program, add method inserts the elements to the end of a List. void main() { List wordsList = ['one', 'two', 'three']; wordsList.add("five"); print(wordsList); } Output: [one, two, three, five] Dart List insert at the beginning with examples The List insert method provides inserting an element at the index position....


Dart| Flutter How to: Multiple ways to clone or copy a List with examples

February 28, 2022 ·  4 min read

A clone is a copy of an object. Let’s create a list in dart. List original = [1, 2, 3]; It does the following things during list object creation. Create a variable for the list i.e. object list data is stored in the memory location Object(original) has a reference to memory location In general, Clone is of two types. Shallow Clone: In this copy process, data exists in the same location of a memory location, but creates two references pointing to the same memory location....


Dart| Flutter How to: Multiple ways to get the First and last letter of a string

February 28, 2022 ·  2 min read

This tutorial shows you multiple ways to get the First and Last Letters of a Given input string. The string is a group of characters enclosed in single or double quotes. How to get the First Letter of a string in Dart and Flutter There are multiple ways we can get the first letter of a string. using index syntax: index in a string always starts with zero and the end index is a string....


Dart| Flutter How to: multiple ways to Remove an element or object from a List with Example

February 28, 2022 ·  3 min read

This tutorial shows you multiple ways to remove elements from a list with examples in dart Dart List remove element examples List class inbuilt methods remove method removeAt method removeWhere method use remove method: List class has a remove method, that removes elements with given input elements. It decreases the size of the list. bool remove(Object? value) It accepts an element. It removes an element, and returns true, if the element is removed from the list, else false is returned....


Dart| Flutter How to: Read pubspec.yaml attributes (version) with examples

February 28, 2022 ·  1 min read

This tutorial explains how to read pubspec.yaml file in the example. pubspec.yaml file contains the following things name: dartapp description: >- dart example application. version: 1.0.0 environment: sdk: '>=2.10.0 <3.0.0' dependencies: ini: ^2.1.0 jiffy: ^5.0.0 quiver: 3.0.1+1 yaml: ^3.1.0 yaml_writer: 1.0.1 image: any mime: any path: any package_info: any dev_dependencies: intl: any How to read pubspec.yaml file in Dart This tutorial is about reading the puspect.yaml file and print the content....


Dart| Flutter How to: remove all whitespaces or trim in a string

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to remove whitespace characters from a given string How to trim leading and trailing whitespace characters in dart string The dart string trim method removes the lead and trail whitespace characters. Syntax: String trim() Here is an example to remove the start and end whitespace characters from the string void main() { String name = ' Hello Welcome '; print(name); print(name.trim()); } Output: Hello Welcome Hello Welcome It removes any whitespace symbols if the string contains new line (\n) or tab(\t) characters,...


Dart| Flutter How to: Run a function repeatedly with a delay

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to execute a function repeatedly with a delay timer in dart and flutter programming. How to execute function repeatedly with delay timer There are multiple ways we can execute a code function periodically with delay time. use the Timer Periodic method First Create a Duration Object with one minute The Timer.Periodic() method allows you to create a timer. Timer Timer.periodic(Duration duration, void Function(Timer) callback) It accepts Duration and Callback function parameters....


Dart| Flutter How to: String replace method

February 28, 2022 ·  2 min read

The string is an immutable class. There is no method such as setCharAt() with an index like in java. We can do multiple ways to replace a character or substring in a String String replace a letter using substring in dart example This example, Replaces the one the character with a new character in a given string. str.substring(0, 2) returns the substring with the start and end index. str.substring(3): returns the substring start index to the remaining string...


Dart| Flutter: Convert List into String examples

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to create an immutable list. Sometimes, You need to Convert List<String> into a Single String. How to Convert List to String in Dart? There are multiple ways we can do use join() method List has a join method that returns the string with an optional separator. default optional parameter is empty. It iterates each element and calls the element.toString() append the result with a separator....


Dart| Flutter: Convert List of Dynamic into List of String examples

February 28, 2022 ·  2 min read

In Dart and flutter, this tutorial explains how to convert List<Dynamic> to List<String> and vice versa. A dynamic type is a primitive type that may hold any dynamic value, such as an integer, a string, or a double. Because a string is a primitive type that stores a collection of characters, automated conversion to/from dynamic is not possible. You can check on How to convert dynamic to string and vice versa or vice versa in Dart and flutter....


Dart| Flutter: Convert List of Strings into List<int> examples

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to Convert List<String> into List<int> in Dart and flutter. String and int types are different primitives and store different values, So automatic conversion are not possible. You can check on How to convert String to int or vice versa in Dart and flutter. How to Convert List of String into List of Int type in Dart This example converts a list of string into a list of int in dart and flutter....


Dart| Flutter: Difference between dynamic vs object with examples

February 28, 2022 ·  2 min read

dynamic and object are two predefined types in Dart dynamic is a dynamic type that accepts any type of value and disables type checking The object is a type that accepts any non-nullable types. This tutorial explains the difference between dynamic and object types in dart Difference between Dynamic and Object Let’s see the difference between dynamic and object with examples. Dynamic variables can be assigned with any type of value, and these variables can be assigned to any type of variable....


Dart| Flutter: Different ways to check differences between two lists with example

February 28, 2022 ·  2 min read

The list contains a growable collection of data. Sometimes you want to find the difference between the two lists. For example, You have two declared lists List list1 = [1,5,10,20,25,30,35]; List list2 = [1,5,7,25,29,30]; What is the difference between the above list? The difference is a common element that is repeated in both lists and is called a difference of the lists. And the output This example shows you multiple ways to find the difference between two lists....


Dart| Flutter: How to add logging to an application with configuration and examples

February 28, 2022 ·  3 min read

This post explains how to add logging into dart and flutter applications. Logging is used to log different types of messages such as information, error, and debug messages, Helps developers to debug errors and issues. Currently, there are two types of popular libraries in Dart Dart logging Dart logger You can add these loggers in Dart and Flutter applications We are going to use the logging library in dart applications....


Dart| Flutter: How to check installed version| SDK version

February 28, 2022 ·  1 min read

Sometimes, We want to find the installed version of Dart and the SDK version. This tutorial shows check the install version of flutter and the SDK version How to Check the installed version of Dart? Type dart --version command in the terminal gives the dart SDK version PS A:\work\dart> dart --version Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "windows_x64" if you want to find the location of the dart SDK location you can type the where dart command in Linux....


Dart| Flutter: How to check the type of a variable is list| Flutter By Example

February 28, 2022 ·  2 min read

This is a simple post to check variable is of a specific or Generic List type. Dart provides an is operator that checks the type of a variable at runtime and returns true for a given variable with a predefined type or not. How to check if a variable is a List in Dart This is operator provides a variable and List type and returns true if a given variable of type List....


Dart| Flutter: How to check the variable type is a String or not| Flutter By Example

February 28, 2022 ·  1 min read

This is a simple post to check variable is of a String type. The ‘is’ operator in Dart checks the type of a variable at runtime and returns true or false depending on whether the variable has a predefined type. String data in dart can be created with variables of type String or dynamic type. stringvariable is String returns true if the variable is a string. How to check given variable type is a String in Dart/Flutter the dynamic type also holds any type of data....


Dart| Flutter: How to Convert timestamp epoch to DateTime local and UTC| Flutter By Example

February 28, 2022 ·  2 min read

Timestamp alias Epoch timestamp or Unix timestamp is a long number that represents the number of milliseconds since 1970-01-01 PST. It is a Count of milliseconds elapsed since 1970-01-01 PST. Sometimes, you need to convert the timestamp to DateTime object in dart and flutter You can check how to get Current Timestamp epcho How to Convert Timestamp to DateTime in Dart and Flutter? This example converts timestamp in milli and microseconds to DateTime...


Dart| Flutter: How to Convert timestamp string from 24 hours to 12-hour format| Flutter By Example

February 28, 2022 ·  1 min read

By default, the DateTime object returns the date and time, time contains a 24-hour format. This tutorial shows how to convert the String of date and time into a DateTime class object in dart and flutter. How to convert time string from 24 hours to 12-hour format in Dart For example, a String contains a date formatted string - 2022-05-20 23:12:20.000. The DateTime.parse() method creates a DateTime object using a formatted string....


Dart| Flutter: How to initialize a final class variable in a constructor? | Flutter By Example

February 28, 2022 ·  2 min read

This tutorial explains how to initialize the final class variable in the constructor. final variables are initialized only once, used only to initialize a variable at runtime. You can use static const for compile-time initialization values Let’s declare the final class field, and initialize the field with the value in the constructor. The below program gives Error: Final field ‘id’ is not initialized and Error: The setter ‘id’ isn’t defined for the class ‘Employee’....


Dart| Flutter: Multiple ways to create immutable List with examples

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to create an immutable list in dart and flutter The list is a mutable list in a dart that allows adding, removing, and updating operations. Immutable lists do not allow to add or update operations and allow only read operations. Due to reading operations, Immutable List is best in performance compared with List. Sometimes, We want to return APIs or methods to return immutable List only....


Different ways to print an object in Dart and Flutter| Dart By Example

February 28, 2022 ·  3 min read

This tutorial shows multiple ways to print a class object in Dart and flutter How to print Class objects How to print Class object using toString() method How to fully dump and print object variables to the console? Print object properties of an instance How to show data from a class Print object variable into JSOn format. The Dart class contains properties and functions, It is a blueprint for an instance of the object created....


Flutter/Dart Difference between the const and final keyword in Dart?

February 28, 2022 ·  3 min read

final and final are keywords applied to variables. Dart and Flutter provide constant values assigned to variables using final and const keywords. const variables know the value at compile time. final variables know the value at Run time. let’s see the sample example of usage of this. const date=“2021-01-01” // compile time constants final date=CalculateDateFunction();// Runtime time constants Let’s see more comparisons with examples Compile-time vs runtime constants Both const and final values are assigned only once....


Flutter/Dart How to: Different ways to iterate a list of elements

February 28, 2022 ·  2 min read

List in a dart programming is the growable list of elements. It is a data structure, that adds, removes, and iterates the list of elements in the insertion order. This post shows you multiple ways of iterating a list of objects in Dart and flutter programming. Dart List Iteration examples There are multiple ways to iterate a List in Dart. For loop with index This is a basic normal for loop, which every programming language provides....


How to convert Double to String or String to double in Dart| Flutter By Example

February 28, 2022 ·  4 min read

This tutorial shows multiple ways to convert double to String or string to double in Dart and flutter programming languages. Convert Double to String in Dart: Double.parse method takes string number and returns adouble value. double.parse("111.12") returns 111.12. Throws FormatException if given string is non-numeric. Double.tryParse method takes string number and returns double value. double.tryParse("111.12") returns 111.12. Does not throw exception and returns null if the string is non-numeric....


How to convert Enum to number or integer to Enum in dart?| Flutter By Example

February 28, 2022 ·  2 min read

In these tutorials, you will learn how to convert an enum to int or int to an enum in dart and flutter programming. Enum is a custom class type to store the constant values. the values can be strings or numbers. Int is a predefined type in Dart or flutter that holds numeric values. Automatic conversion is not possible due to different types of data. Let’s declare Enum constants in Dart or Flutter...


How to convert List to Map or vice-versa in Dart| Flutter By Example

February 28, 2022 ·  2 min read

This tutorial shows multiple ways to convert List to Map in Dart or flutter programming. The List is a dynamic collection of objects in Dart. The map is a data structure to store key and value pairs. Both are different types in Dart or Flutter, and We have to write code to convert from one type into another. How to convert List to Map in Dart or Flutter programming List....


How to convert List to Set or vice-versa in Dart| Flutter By Example

February 28, 2022 ·  1 min read

This tutorial shows multiple ways to convert List to Set in Dart or flutter programming. The List is a dynamic collection of objects in Dart, elements are inserted in insertion order and allow duplicate objects. The Set is a data structure to store a collection of elements and does not allow duplicates. Both are different types in Dart or Flutter, and We have to write code to convert from one type into another....


How to print dollar symbol in string dart?| Flutter By Example

February 28, 2022 ·  1 min read

You can append any string with another string using the plus operator or interpolation syntax. Similarly, You can add a dollar symbol to a string in multiple ways. How to print the dollar symbol in Dart and Flutter? There are multiple ways The string contains normal text or raw text which is interpreted with interpolation syntax. interpolation syntax uses the $ symbol to print the variable value. For example, if you interpolate syntax, You can use $price to print the variable value....


How to use double dot operator- Cascade operator in Dart| Flutter

February 28, 2022 ·  2 min read

cascade operator is used to call a sequence of methods on the objects using .. double dot operator. For example, you have a list object and want to call the same add method for multiple values. You will call as below List list = []; list.add(1); list.add(2); list.add(3); list.add(4); The object name list is repeatedly called to do the same operation. You can also do multiple operations on the same object....


How to: Check if the email is valid or not in Dart| Flutter By Example

February 28, 2022 ·  2 min read

This program checks how to validate the email address. Dart provides a RegExp class for matching strings with regular expression Following are the rules for a valid email address. Email has different valid parts - sender name,@ symbol, and domain name recipient and domain names may contain lower and upper case numbers domain name contains an extension separated by a dot(.) special characters are allowed in the sender’s name sender name length is 64 characters domain name is 256 characters Valid emails are [email protected]


How to: Check if the Phone number is valid or not in Dart| Flutter By Example

February 28, 2022 ·  2 min read

This program checks how to validate the phone number validation. Dart provides a RegExp class for matching strings with regular expressions. Following are the rules for valid phone numbers. phone number only contains numerical numbers and Optional symbol(+) only letters are not allowed Optional + or zero with beginning followed by digits from 1 to 9 Phone number can contain 10 or 12 digits Valid phone numbers are +9166666666666 and Invalid emails are abc, and 123....


How to: Convert Future String to String and vice versa in Dart| Flutter

February 28, 2022 ·  2 min read

This tutorial shows, how to Convert Future<String> to String in Dart and Flutter programming. Asynchronous programming is supported through the async and await keywords in Dart and Flutter. When retrieving data from the backend, data loads asynchronously before displaying it in the front end. The Future class uses for asynchronous operations in the Dart application. It stores the various types of values returned by async operations. Its value is always a future value that awaits the completion of the function....


How to: Convert List to List in Dart| Flutter By Example

February 28, 2022 ·  2 min read

This tutorial shows you how to Convert Future<List> to List in Dart and Flutter programming. Dart and flutter provide async and await keywords for asynchronous. When you are retrieving the data from the backend, loaded it asynchronously and display it in the frontend. Future are classes for asynchronous operations in the Dart application. It holds the values of different types returned from async operations. Its value always returns status uncompleted and completed....


How to: Generate Random String in Dart| Flutter By Example

February 28, 2022 ·  2 min read

Random Generator is used to generate a unique value for every invocation. This talks about multiple ways to generate a random string for example. Dart/Flutter Random String generate example This example generates a Random String with values. Following are steps to follow. First, create a constant Character Array of alphabets and special characters. Find the Random number between zero to character array length Create a List of random Unicode numbers using the Iterable....


How to: How to get Hostname in Dart| Flutter By Example

February 28, 2022 ·  1 min read

Sometimes, We need to get the hostname of a running application in the current environment in the dart and flutter application This post shows multiple ways to get a hostname in the dart and flutter project. How to get Hostname in the dart application dart:io package provides platform class that provides information of an running environment. Platform class has a static method localHostname that returns the hostname of a system....


Multiple ways convert String to DateTime in dart with examples| Flutter By Example

February 28, 2022 ·  2 min read

This tutorial shows how to convert the String of date and time into a DateTime class object in dart and flutter. This post contains code, convert String into Date time using the Datetime.parse() method. Also, How we can convert the Date format to a different format using dateFormat.forma() method How to convert String into DateTime in Dart? For example, a String contains a date formatted string - 2022-05-20 00:00:00.000. DateTime....


Subscribe
You'll get a notification every time a post gets published here.