errOrNull property

E? get errOrNull

Returns the error value if this is Err, otherwise null.

Result.err('bad').errOrNull; // 'bad'
Result.ok(42).errOrNull;     // null

Implementation

E? get errOrNull => isErr ? (this as Err<T, E>).error : null;