CatchAllResult<T extends Object?> typedef

CatchAllResult<T extends Object?> = Result<T, Object>

A result type that captures either a successful value or any error.

This is useful for functions that may fail with any type of error. The error type is Object, making it a catch-all for any exception. Commonly used with try-catch blocks where the error type is unknown.

Example:

CatchAllResult<String> parseJson(String json) {
  try {
    return Ok(jsonDecode(json));
  } catch (e) {
    return Err(e);
  }
}

Implementation

typedef CatchAllResult<T extends Object?> = Result<T, Object>;