Skip to main content

Data types

Dart supports several data types. In this article, we will learn about some of them:

String"Hello world"
int1, 5, 10, 100
double1.5, 0.25, 10.5
num1, 1.5, 10
booltrue, false


The String data type holds a sequence of characters. You can create a string using single quotes ' or double quotes ".

var myString1 = 'This is a string';
var myString2 = "This is another string";


The int data type holds integer values no larger than 64 bits, depending on the platform. On native platforms, values can be from -263 to 263 - 1. On the web, integer values are represented as JavaScript numbers (64-bit floating-point values with no fractional part) and can be from -253 to 253 - 1.

var myNumber = 5000;


The double data type holds floating-point numbers.

var myDouble = 1.25;


The num data type can hold integers or floating-point numbers. For example:

num myNum1 = 100;
num myNum2 = 1.25;


The bool data type can hold only two values: true or false:

var myBoolean = true;

DartPad example​


We learned about some of the data types supported by Dart. Of course, there are many more data types like Maps, Lists, Sets, etc. But we will learn about them in the following articles of this course.