when<T> method
T
when<T>({})
Implementation
T when<T>({
required T Function(Loaded<Record>) loaded,
required T Function(Added<Record>) added,
required T Function(Updated<Record>) updated,
required T Function(Removed<Record>) removed,
}) {
if (this is Loaded) return loaded(this as Loaded<Record>);
if (this is Added) return added(this as Added<Record>);
if (this is Updated) return updated(this as Updated<Record>);
if (this is Removed) return removed(this as Removed<Record>);
throw Exception('Invalid Change');
}