diene_result 1.0.0 copy "diene_result: ^1.0.0" to clipboard
diene_result: ^1.0.0 copied to clipboard

Sealed Result and Option types with C0-compatible wire codecs for Dart applications.

diene_result #

pub package CI unit coverage meta coverage

Sealed, synchronous Result<T> and Option<T> values for Dart, with C0-compatible tagged-array wire codecs and a dependency-light consumer test helper.

import 'package:diene_problems/diene_problems.dart';
import 'package:diene_result/diene_result.dart';

final Result<int> result = Result<int>.ok(21)
    .map((value) => value * 2)
    .andThen((value) => Result<int>.ok(value));

final String message = result.match(
  ok: (value) => 'answer: $value',
  err: (Problem problem) => problem.title,
);

The error channel is the sole RFC 9457 Problem identity owned and exported by diene_problems; diene_result depends on that package and does not define or re-export a competing envelope. serial() emits the C0 tagged arrays:

  • ['ok', value] / ['err', problemJson]
  • ['some', value] / ['none', null]

Import package:diene_result/test_helper.dart in consumer tests for expectOk, expectErr, expectSome, and expectNone. The sub-library has no test-framework dependencies and adds no runtime dependency beyond the package's canonical diene_problems edge.

Read the Result standard for the complete API, wire contract, TestHelper guidance, and deliberate Bun-family deltas.

Development #

  • pls setup resolves the workspace dependencies.
  • pls test runs unit, C0 conformance, and TestHelper meta suites.
  • pls test:coverage enforces the separate unit and meta ledgers.
  • pls deadcode runs repository and production-only dead-code passes.
  • pls package:validate runs the release guard, publish dry-run, and pana.
0
likes
160
points
1.44k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Sealed Result and Option types with C0-compatible wire codecs for Dart applications.

Repository (GitHub)
View/report issues

Topics

#result #option #error-handling #functional-programming #railway-oriented-programming

License

MIT (license)

Dependencies

diene_problems

More

Packages that depend on diene_result