Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

Learn Dart Datatype

In Dart, data types represent the kind of data that can be stored and manipulated by variables. Dart is a statically typed language, meaning that variables must have a specific type declared at compile-time. Here are the commonly used data types in Dart:



Type of Data-Type

1. Number :
(a) int: Used to represent integers (whole numbers) such as -10, 0, 42.
(b) double: Used to represent floating-point numbers (numbers with decimal points) such as 3.14, -0.5, 2.71828.


2. Strings: Used to represent sequences of characters, such as "Hello, Dart!".

3. Booleans (bool) : Used to represent boolean values, either true or false.
4. Lists : Used to represent ordered collections of objects. Lists can contain elements of different data types.Example

List < int > numbers = [1, 2, 3, 4, 5];
List < String > names = ['Alice', 'Bob', 'Charlie'];


5. Map : Used to represent collections of key-value pairs. Maps can have keys and values of different data types. Example:

Map < String, int> ages = {'Alice': 30, 'Bob': 25, 'Charlie': 35};


6. Dynamic: A special type that can hold values of any data type. Use dynamic when the type of a variable is not known until runtime. Example:

dynamic value = 42;
value = 'Dart';


7. Object : The superclass of all Dart classes. All Dart objects ultimately extend Object. Example:

Object obj = 'Hello';


These are the basic data types in Dart that are commonly used for storing and manipulating data in Dart programs. Understanding these data types is essential for writing Dart code effectively.



Advertisement





Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java