Fold is used to handle both Ok and Err cases.
@override B fold<B>(B Function(T value) onOk, B Function(E error) onErr) => onErr(error);