Skip to content

Make Result sealed and subclasses final - #970

Merged
natebosch merged 3 commits into
mainfrom
result-final-class
Jul 16, 2026
Merged

natebosch merged 3 commits into
mainfrom
result-final-class

Conversation

@natebosch

@natebosch natebosch commented Jul 9, 2026 •

Copy link
Copy Markdown
Member

These were never intended for extension and marking them final makes
it easier to expand the API without breaking changes.

  • Mark Result as sealed class.
  • Mark ValueResult and ErrorResult as final class.
  • Refactor Result, ValueResult, and ErrorResult into a single
    library using part and part of to allow inheritance within the
    library.
  • Remove redundant exports of error.dart and value.dart from
    lib/async.dart.

These were never intended for extension and marking them `final` makes
it easier to expand the API without breaking changes.
@natebosch
natebosch requested a review from a team as a code owner July 9, 2026 22:14
@natebosch
natebosch requested a review from lrhn July 9, 2026 22:14
@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

PR Health

Unused Dependencies ✔️
Package Status
async ✔️ All dependencies utilized correctly.

For details on how to fix these, see dependency_validator.

This check can be disabled by tagging the PR with skip-unused-dependencies-check.

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
async Non-Breaking 2.13.1 2.14.0-wip 2.14.0-wip ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Coverage ⚠️
File Coverage
pkgs/async/lib/async.dart 💔 Not covered
pkgs/async/lib/src/result/error.dart 💚 88 %
pkgs/async/lib/src/result/result.dart 💚 84 %
pkgs/async/lib/src/result/value.dart 💚 80 %

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

License Headers ✔️
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
// 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.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/collection/benchmark/legacy_quicksort.dart

This check can be disabled by tagging the PR with skip-license-check.

@natebosch

Copy link
Copy Markdown
Member Author

This passed an internal test run, I think it's worth landing.

Comment thread pkgs/async/lib/src/result/result.dart Resolved
@natebosch natebosch changed the title Make Result and subclasses final Make Result sealed and subclasses final Jul 16, 2026
@natebosch
natebosch merged commit 77dadb3 into main Jul 16, 2026
22 checks passed
@natebosch
natebosch deleted the result-final-class branch July 16, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants