Member-only story
Data Types in Dart
Data types in Dart define the type of value a variable can hold, such as numbers, text, or logical values. Dart is an optionally typed language, meaning you can explicitly declare types or let Dart infer them automatically.
Read this story for free 👇
Numbers (int, double, num)
Dart supports three main types for numbers:
- int: Represents whole numbers without decimal points.
- double: Represents floating-point numbers (numbers with decimal points).
- num: A supertype for both
intanddouble, allowing either type.
Example:
int num1 = 100;
double num2 = 130.2;
num num3 = 50;
num num4 = 50.4;
num sum = num1 + num2 + num3 + num4;
print("Sum is $sum");Strings (String)
Strings represent sequences of characters (text) and can be enclosed in single or double quotes.
Example:
String schoolName = "Diamond School";
String address = "New York 2140"…









