The Dart Programming Language in Five Minutes

A quick overview for those already familiar with similar languages, like Java, Kotlin, C++, and C#

Image for post
Image for post
Photo by Silvan Arnet on Unsplash
Image for post
Image for post allows you to experiment with Dart from the browser —screenshot by author

Hello World

void main() {
print('Hello World!');

Dart code is compact

class Person {
String name;
int age;

Person(, this.age);

int lieAboutMyAge() {
print("My name is $name, my age is ${age - 10}");

void main() {
final me = Person("Erik", 38);
var girlfriend = Person("Shannon", 30);


Type Inference

Final and Const


if (age.isNegative) {
print("The age can not be negative, you fool!")

Private and public

Expressions and statements

Lists, Sets, and Maps

var myList = [1, 2, 3];
assert(myList.length == 3);
assert(myList[1] == 2);
var constantList = const [1, 2, 3];
constantList[1] = 1; // This causes an error!
var mySet = {'john', 'eric', 'martha'};
var elements = <String>{};
var gifts = {
'first': 'partridge',
'second': 'turtledoves',
'fifth': 'golden rings'
gifts['fourth'] = 'calling birds';

Dart Package Manager


Written by

Software developer by day, writer at night. Webmaster at

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store