twofold 0.1.0 copy "twofold: ^0.1.0" to clipboard
twofold: ^0.1.0 copied to clipboard

A small utility for representing values with two possible outcomes, commonly failure or success.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project follows Semantic Versioning.

0.1.0 Initial release #

Added #

  • Twofold<L, R> core type for representing two-outcome values
  • Constructors for creating left and right values
  • Extension methods for:
    • inspecting state (isLeft, isRight)
    • safe and unsafe value access
    • handling outcomes (fold, when)
    • transforming values (map, mapLeft, flatMap)
    • fallback handling (getOrElse, getOrElseGet)
    • utility helpers (swap, toList, toStringValue, isEqualTo, hashValue)

Notes #

  • Invalid states (both values null) are possible in this version and will throw at runtime
  • API is intentionally minimal and synchronous
4
likes
150
points
98
downloads

Publisher

unverified uploader

Weekly Downloads

A small utility for representing values with two possible outcomes, commonly failure or success.

Repository (GitHub)
View/report issues

Topics

#error-handling #utility #functional #dart

Documentation

API reference

License

MIT (license)

More

Packages that depend on twofold