Thuta Learning
BasicMobile Developmentbeginner

Intro to Dart

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

Flutter apps are written in Dart. Dart's syntax is somewhat similar to languages like JavaScript, Java, and C#, so you can write variables, functions, classes, and async/await cleanly and easily. Knowing the basics of Dart is really important for understanding Flutter UI.

dart
void main() {
  var framework = 'Flutter';
  int year = 2017;
  bool isFun = true;

  int add(int a, int b) {
    return a + b;
  }

  print('Learning $framework');
  print('Stable release year: $year');
  print('Is it fun? $isFun');
  print('2 + 3 = ${add(2, 3)}');
}
You should see
The console will print output like Learning Flutter, Stable release year, Is it fun?, and 2 + 3 = 5.

What's Next

Once you've got the Dart basics down, check out the Flutter widget structure in the Hello World App.

Easy traps

  • Use ${} for expressions in string interpolation. Writing a function call like ${add(2, 3)} as $add(2, 3) is incorrect.
Intro to Dart | Thuta Learning