Final Fields and Deep Immutability
Build objects that never change.
Immutable by Design
An immutable object never changes after it is built. That makes your data predictable and safe to share across your whole app. 🔒
Meet final
A final field is set once, during construction, and can never be reassigned. It locks the value in place for the life of the object.
class Point {
final int x;
Point(this.x);
}All lessons in this course
- Final Fields and Deep Immutability
- sealed Classes and Exhaustive switch
- base, interface, and final Modifiers
- copyWith and Value Equality