From 79cb8fd4cd1b5a0d96d3d372aec53d6c710f6704 Mon Sep 17 00:00:00 2001 From: Andrei Lesnitsky Date: Tue, 23 Apr 2024 02:19:43 +0200 Subject: [PATCH] feat: better hierarchy --- lib/result.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/result.dart b/lib/result.dart index 9dcac38..8c4dfd3 100644 --- a/lib/result.dart +++ b/lib/result.dart @@ -25,11 +25,11 @@ sealed class Result { } } -sealed class LateResult { +sealed class LateResult implements Result { const factory LateResult.pending() = Pending._; const factory LateResult.success(T value) = Success._; const factory LateResult.failure([ - Object? failure, + Object? exception, StackTrace? stackTrace, ]) = Failure._; @@ -38,15 +38,15 @@ sealed class LateResult { try { await for (final value in stream) { - yield Late.success(value); + yield Success._(value); } } catch (e, s) { - yield Late.failure(e, s); + yield Failure._(e, s); } } } -sealed class AsyncResult { +sealed class AsyncResult implements Result { /// Creates a [Success] result. const factory AsyncResult.success(T value) = Success._; @@ -76,7 +76,7 @@ sealed class AsyncResult { } } -sealed class LateAsyncResult { +sealed class LateAsyncResult implements Async, Late { const factory LateAsyncResult.pending() = Pending._; const factory LateAsyncResult.success(T value) = Success._; const factory LateAsyncResult.failure([