Result<V extends Object, E extends Exception>.fromResult constructor

Result<V extends Object, E extends Exception>.fromResult(
  1. Result<V, E> result,
  2. Type? classLocation,
  3. String? functionLocation,
  4. Map<String, dynamic> monitor,
  5. Map<String, dynamic> debug,
  6. Iterable<Log> histories,
)

syntax sugar.

Implementation

factory Result.fromResult(
    Result<V,E> result,
    Type? classLocation,
    String? functionLocation,
    Map<String, dynamic> monitor,
    Map<String, dynamic> debug,
    Iterable<Log> histories,
) {
    switch (result) {
        case Success(asValue: final value): return Success(value, classLocation, functionLocation, monitor, debug, histories);
        case Failure(asError: final error): return Failure(error, classLocation, functionLocation, monitor, debug, histories);
    }
}