toError method

Result<T> toError({
  1. Object? error,
  2. StackTrace? stackTrace,
  3. T? data,
  4. DateTime? lastUpdate,
})

Attempts to convert the result to Error.

Implementation

Result<T> toError({Object? error, StackTrace? stackTrace, T? data, DateTime? lastUpdate}) {
  return Error(
    error: error ?? ResultNotifierException(message: 'Unknown'),
    stackTrace: stackTrace,
    data: data ?? this.data,
    lastUpdate: lastUpdate ?? DateTime.now(),
  );
}