getError method
Returns the failure value, or throws an exception if this is a Success.
Implementation
(L, StackTrace?) getError() {
return switch (this) {
Success<L, R>() => throw StateError('Cannot get error value from a Success.'),
Failure<L, R>(value: final l, stackTrace: final s) => (l, s),
};
}