Back to Writing
NOTESflutterdartmathnumbersprogramming
Flutter - Dart (3). Numbers and Math
May 1, 2020•Updated Feb 17, 2026
Learning Dart numbers and math:
// Variables
int number = 10;
double decimal = 3.14;
// Basic operations
int sum = 10 + 20;
int product = 10 * 20;
double division = 20 / 10;
// Math library
import 'dart:math';
// sqrt function
double squareRoot = sqrt(9); // 3.0
// pow function
double power = pow(2, 3); // 8.0
// Trigonometric functions
double sine = sin(pi / 2); // 1.0
double cosine = cos(0); // 1.0
double tangent = tan(pi / 4); // 1.0
// Rounding
int rounded = 3.7.round(); // 4
int floored = 3.7.floor(); // 3
int ceiled = 3.7.ceil(); // 4
// Absolute value
int absolute = -10.abs(); // 10