Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(package:async): migrate the Result class to sealed class #714

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/async/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.13.0-wip

- migrate the Result class to sealed class

## 2.12.0

- Require Dart 3.4.
Expand Down
2 changes: 0 additions & 2 deletions pkgs/async/lib/async.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ export 'src/future_group.dart';
export 'src/lazy_stream.dart';
export 'src/null_stream_sink.dart';
export 'src/restartable_timer.dart';
export 'src/result/error.dart';
export 'src/result/future.dart';
export 'src/result/result.dart';
export 'src/result/value.dart';
export 'src/single_subscription_transformer.dart';
export 'src/sink_base.dart';
export 'src/stream_closer.dart';
Expand Down
5 changes: 1 addition & 4 deletions pkgs/async/lib/src/result/error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'result.dart';
import 'value.dart';
part of 'result.dart';

/// A result representing a thrown error.
class ErrorResult implements Result<Never> {
Expand Down
7 changes: 4 additions & 3 deletions pkgs/async/lib/src/result/result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import 'dart:async';
import '../stream_sink_transformer.dart';
import 'capture_sink.dart';
import 'capture_transformer.dart';
import 'error.dart';
import 'release_sink.dart';
import 'release_transformer.dart';
import 'value.dart';

part 'value.dart';
part 'error.dart';

/// The result of a computation.
///
Expand All @@ -22,7 +23,7 @@ import 'value.dart';
///
/// A [Future] represents a potential result, one that might not have been
/// computed yet, and a [Result] is always a completed and available result.
abstract class Result<T> {
sealed class Result<T> {
/// A stream transformer that captures a stream of events into [Result]s.
///
/// The result of the transformation is a stream of [Result] values and no
Expand Down
5 changes: 1 addition & 4 deletions pkgs/async/lib/src/result/value.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'error.dart';
import 'result.dart';
part of 'result.dart';

/// A result representing a returned value.
class ValueResult<T> implements Result<T> {
Expand Down