📱 Flutter
Advanced
What is the freezed package in Dart?
Answer
freezed is a code generation package that creates immutable data classes with proper ==, hashCode, toString(), and a copyWith() method. Annotate a class with @freezed and run build_runner. It also supports union types (sealed classes), making it ideal for modeling BLoC/Cubit states: @freezed class AuthState with _$AuthState { const factory AuthState.loading() = _Loading; ... }. The generated when() and map() methods provide exhaustive pattern matching over union variants.
Previous
What is FlutterSecureStorage?
Next
What is the Element tree in Flutter and what role does it play?