domain_error 5.0.2
domain_error: ^5.0.2 copied to clipboard
Domain errors with Result, DomainResult, and captureResult for expected errors in Dart applications.
5.0.2 #
- Publish flutter-domain-errors with version-aware rules and runnable examples for domain_error 3.x, 4.x, and 5.x through the standard skills CLI.
- Document project-local and optional global installation. Dart APIs, runtime behavior, dependencies, and SDK requirements remain unchanged.
5.0.1 #
- Concentrate symmetric payload equality in one private function shared by both Result branches, preserving comparison order, type checks, hashing, and the public interface.
- Record the focused architecture review and rejected broader refactors in ADR 0006.
5.0.0 #
- Rename the generic outcome to
Result<T, E>, with the success type first. - Rename domain aliases to
DomainResult<T>andFutureDomainResult<T>. - Use
ResultError/ResultSuccessanderror/valuebranch fields. - Rename the domain getter extension to
DomainResultErrorand the Future composition extension toFutureResult. - Update callers, examples, diagrams and the glossary together. See the 4.x to 5.0 migration guide for all source changes. There are no compatibility aliases.
- Preserve capture/composition behavior, diagnostic identifiers, error messages, equality rules, and Dart 3.0 / Flutter 3.10 compatibility.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased #
4.0.0 - 2026-10-20 #
Changed #
- Pass the mapper and optional observers directly to capture functions as named
parameters. Remove
CaptureResultOptionsandCaptureResultSyncOptions. - Require
Nullreturns from synchronous observers, rejecting async callbacks and directvoidtear-offs. Preserve observer isolation and error routing.
Added #
- Sequential composition with
andThen, error transformation withmapError, and selective result-returning recovery withrecover. - Async equivalents on
Eitherand composition methods onFuture<Either<L, R>>. - A migration guide, runnable migration example, compile-time callback checks, and extended minimum/stable Flutter consumer coverage.
3.1.0 - 2026-10-20 #
Changed #
- Lower the Dart SDK minimum to 3.0.0 and widen runtime dependency ranges for Flutter 3.10.0 compatibility, preserving the public API and behavior.
- Align development dependencies, callback test syntax, lint configuration, and formatting commands with the supported minimum SDK.
Added #
- A separate Flutter consumer with public-interface tests on Flutter 3.10.0 and current stable, including the lowest supported runtime dependencies.
- Minimum and stable SDK checks for Dart and Flutter in CI.
3.0.0 - 2026-09-13 #
Changed #
- Rename the capture functions and options to
captureResult,captureResultSync,CaptureResultOptions, andCaptureResultSyncOptions. - Use
Either.error/Either.success,EitherError/EitherSuccess,isError/isSuccess, anderrorValuethroughout the API. - Rename
DomainError.rawErrortocauseandmapRawErrorToDomaintomapToDomainError. Previous public names are removed without aliases. - Require matching concrete types and symmetric deep payload equality for
Either; include the concrete type in hashing. - Exclude causes and stack traces from
DomainErrorequality. Subclasses can continue adding business fields throughprops. - Preserve operation results when observers fail. Mapper failures still propagate.
- Normalize message and cause descriptions to one line and use
unknownwhen a cause cannot be described. - Make
format-checkread-only and simplify analyzer configuration while preserving applicable checks and strict type settings.
Added #
- Optional
onObserverErrorhandlers for synchronous and asynchronous capture. Handler failures are ignored without recursion. - Regression tests for equality, callback ordering, delayed failures, immutable snapshots, and diagnostic formatting.
- Migration instructions and explicit synchronous callback requirements.
- Editable HTML/CSS diagram sources with a headless Chrome rendering command.
- CI checks for Dart 3.13.0 and the stable channel.
2.1.1 - 2026-08-30 #
Added #
- README diagrams for the error journey, the domain model, and the Result API.
2.1.0 - 2026-08-30 #
Added #
executeSafelySyncandExecuteSafelySyncOptionsfor synchronous calls that returnResult<T>.
2.0.0 - 2026-08-30 #
Changed #
ExecuteSafelyOptions:onErroris nowonDomainError,onThrownis nowonRawError, andmapThrownToErroris nowmapRawErrorToDomain. The options type is no longer generic and no longer extendsEquatable.DomainError.erroris nowrawError.Eitheris sealed. The error branch isisErr/errValue/Either.err. The success branch isisOk/successValue/Either.ok.foldnow takesifErrandifOk.whenis removed.mapmaps the success value and leaves an error unchanged.domainErroris available only onResult<T>, not on a genericEither.executeSafelynow returnsFuture<Result<T>>.FutureOrResultis removed.
1.0.0 - 2026-08-30 #
Added #
DomainErrorbase type with a stabletypeIdentifier, optionalmessage,error, andstackTrace.Eitherwithfailureandvaluebranches, plusfold,when, andmap.Result,FutureResult, andFutureOrResultasEitheraliases overDomainError.executeSafelyto catch throws and return aResult.ExecuteSafelyOptionswithmapThrownToError,onError, andonThrown.
