This program demonstrates the fundamental data types supported by the Dart programming language.
Key Data Types:
- Numbers:
int
: Represents whole numbers (e.g.,age = 26
).double
: Represents floating-point numbers with decimals (e.g.,weight = 60.4
).
- Strings:
String
: Represents sequences of characters (e.g.,name = 'Odunze Jennifer'
).
- Booleans:
bool
: Represents logical values (true
orfalse
) (e.g.,isDartCool = true
).
- Lists:
List
: Represents ordered collections of items (e.g.,fruits = ['Orange', 'Apple', 'Banana']
).
- Maps:
Map
: Represents collections of key-value pairs (e.g.,prices = {'apple': 2, 'banana': 3, 'orange': 1}
).
- Runes:
Runes
: Represents Unicode code points (less common for most use cases).
- Null Safety:
- Dart supports defining variables that can be
null
(no value assigned).
- Dart supports defining variables that can be
Example Usage: Refer to the provided codes