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.
The next item in the agenda is the bool data type.
The bool data type in Dart can hold one of two possible values: true or false. This particular data type is extensively used in logical expressions and decision-making structures. Here's a simple example:
Dart treats String as a basic data type, using it to store a sequence of characters — or simply put, text. The string is always encased within either double or single quotes.
In Dart, the String data type is immutable. Once a String value is created, its content cannot be changed; however, the variable referencing the String can be reassigned to point to a different String value.
