Do you use ‘sealed’ classes in your Flutter apps? With sealed classes, you can: - Create a known, enumerable set of subclasses - Use switch case over subclasses you create - Add properties and methods, differently from enums - Catch errors at compile time, reducing the amount of errors at runtime Also, you can only create a subclass of the ‘sealed’ class in the same file. This allows you to have better readability and maintainability of the abstract class and its subclasses. Do you ever use sealed classes in your Flutter apps? #flutter #flutterdevelopment
I could use an abstract class. What is the use of a sealed class then?
Informative
Aaron Villa This might be up your alley mate.
Flutter Developer @ Siemens Energy | Writing about Flutter, App Development and Remote Work
6mo📌 Here you can read more about sealed classes: https://dart.dev/language/class-modifiers