Brewing with a Chemex probably seems like a complicated, time-consuming ordeal, but once you get used to the process, it becomes a soothing ritual that's worth the effort every time.
Type-safe field definition, using class instead of basic type
wrap a failure message, instead of throwing exception;
freezedpackage provide code generation of Generic type with
unionvalue. In stead of coding so many different types of failure message, and still require memorise your own definition of failures.
freezedgenerates mixin class naming like
_$YourClassname<T>, so don't feel strange when you see class definition tailing
with _$Blahblah, that means you are extending functions from freezed-genented code.
freezedgenerated code require
partimport into annotated class, see what is part import
Monad to combine
union type failure message at the left, and right is correction response.
Eitherclass for this.
dartzfunctions like fold or getOrElse to check left or right value.
sealed class, in Kotlin if a class modifier with
sealed that means in the definition file you have to define all possible subclasses of it. Once this is done, there will nowhere else can extend the sealed class.
This means you can easily solid how many children class type a sealed class have.
mixinclass, in Dart mixins are a way of reusing a class’s code in multiple class hierarchies. Because Dart is only one parent inheritance, you can't extend multiple classes, but using
withkeyword to reuse mixin classes functions.