Dart Intermediate Introduction
This course deepens the Dart skills from the beginner course. It builds stronger programs with safer null handling, richer collections, and more capable classes.
A greeting on screen
This short program shows one greeting. The greeting is the whole output.
void main() {
print('Dart Intermediate');
}A safe read from the beginner course
name holds a text value, so the safe read reaches its length. print shows the length 3.
void main() {
String? name = 'Ana';
print(name?.length ?? 0);
}A list and its first element
The list holds three numbers. The first print shows the count and the second print shows the first element.
void main() {
var nums = [1, 2, 3];
print(nums.length);
print(nums[0]);
}Example
int add(int a, int b) {
return a + b;
}
void main() {
print(add(2, 3));
print(add(10, 5));
}Key points
- Null safety goes deeper here with late variables, type promotion, and definite assignment.
- Collection lessons cover lists, maps, and sets in more detail.
- Generics let one class or function work safely with many types.
- Classes gain stronger constructors, properties, and inheritance tools.
- Functions gain closures, and error handling gains custom exceptions.
- The course ends with a taste of futures for work that finishes later.
- Dart also powers Flutter apps, and this course stays with plain Dart programs.
In this example, the add function returns the sum of its two numbers. The first call adds 2 and 3, so the first print shows 5. The second call adds 10 and 5, so the second print shows 15.
Try it Yourself
Edit the code, then press Run.
Running is simulated · DartPad
Exercise
What does this course build on?