Dart, like all programming languages, provides basic data types that act as building blocks for coding. In this lesson, we will delve into the core data types in Dart: int
, double
, bool
, String
, and null
. We will learn how to use these data types to represent numbers, boolean values, text data, and the absence of value, respectively.
In Dart, numerical data types are used to represent numbers. Specifically, this section focuses on int
and double
. The int
data type is used to represent whole integer numbers, while the double
data type is used to represent decimal numbers — numbers with decimal points.
The largest value an int
can store is 9223372036854775807
, which is . The smallest value it can hold is , which is . Here's an example of using the data type:
