matchError<E extends Object> method

Option<E> matchError<E extends Object>()

Returns an Option containing the error if its type matches E.

Implementation

@pragma('vm:prefer-inline')
Option<E> matchError<E extends Object>() =>
    value is E ? Some(value as E) : const None();