Sitemap
Dart Tutorials

Dart Tutorials for beginners and advanced programmers

Data Types in Dart

2 min readMar 23, 2025

--

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.

Press enter or click to view image in full size

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 int and double, 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"…

--

--

Usama Sarwar
Usama Sarwar

Written by Usama Sarwar

Helping founders turn ideas into market-ready web and mobile apps within 30 days using Google’s Flutter & Next.js without juggling multiple teams.

Dart Tutorials
Dart Tutorials

Published in Dart Tutorials

Dart Tutorials for beginners and advanced programmers