Dart Foundations
Dart: the mental model
Dart is a strongly typed language designed around productive application development. Flutter uses Dart because its type system, async model and tooling fit UI development well.
Core ideas
- Variables have static types, but local inference is common.
- Null safety makes nullable values explicit with ?. and ?. or ! when you have proved a value is non-null.
- Functions are first-class values and can be passed as callbacks.
- async and await provide readable asynchronous code.
- Classes, mixins, extensions and generics support reusable application architecture.
dart
String name = 'LaySoftware';
int lessons = 100;
String? nickname;
final label = nickname ?? name;Rule of thumb
Prefer final for values that should not be reassigned. Use var when the type is obvious and mutable state is intentional.
Lesson complete?Use the next lesson to continue the learning path.