Thuta Learning
BasicProgrammingbeginner

Variables

Relax. We'll talk through this in plain words — no textbook voice.

Think of a variable as a little box that holds a value. Dart gives you var, explicit types, final, and const for different situations.

dart
void main() {
  var language = 'Dart';
  String framework = 'Flutter';
  final currentYear = DateTime.now().year;
  const appType = 'Cross-platform app';

  print('$language works well with $framework.');
  print('Year: $currentYear');
  print('Use case: $appType');
}

$language and $framework are string interpolation — a way to insert a variable's value into a String. DateTime.now().year grabs the current year at runtime, which is why final is the right fit for it.

You should see
Dart works well with Flutter. Year: 2026 Use case: Cross-platform app

Easy traps

  • It's not quite enough to just remember "final and const both mean you can't reassign." const requires a compile-time value — you can't put DateTime.now() inside a const.
Variables | Thuta Learning