nidula 1.1.0 copy "nidula: ^1.1.0" to clipboard
nidula: ^1.1.0 copied to clipboard

A Dart library for Rust-like Option/Result types. Offers a compile-time safe and chainable parallel to Rust's try operator for None/Err propagation.

1.1.0 #

  • Add Nest type.

1.0.3 #

  • Shortened project description, due to pub.dev considering it too long.

1.0.2 #

  • Improved project description.
  • Made small adjustments to vscode snippets.

1.0.1 #

  • Fixed typo in docs.

1.0.0 #

  • Exported chaining methods at library level.
    • Accidentally forgotten in version 0.7.0.
  • Changed return type of chain/chainSync chaining methods to a generic type of your choice A.
  • Included onAny/onAnySync chaining methods.
  • Corrected chaining extension names for Option<T> and Future<Option<T>>.
  • Improved docs.
  • For Nix devs: updated flake. Some pull requests that enormously improve Flutter/Dart support were recently merged (nixpkgs).
  • Moved repository to Codeberg.

0.7.0 #

  • Renamed syncTryScope to just tryScope.
  • Included chaining methods (chain, onOk, onSome, ...).
  • Improved docstring.
  • Updated VSCode snippets.

0.6.0 #

  • Majorly improved docstring throughout entire codebase.
  • Improved docs.
  • Removed Option.mapOrNull, Result.mapOrNull and Result.mapErrOrNull.
  • Removed Option.unwrapOrNull.
  • Replaced Result.unwrapOrNull and Result.unwrapErrOrNull with , Result.okToNullable and Result.errToNullable.
  • Improved Result.toJson and Option.toJson type-safety-wise (transformers are now required).

0.5.0 #

  • Made Option's T and Result's T and E nullable.
  • Added extensions for all *orNull methods.
    • These methods are available only with non-nullable types, e.g., types extending Object.
  • Added more pattern matching snippets.
  • Added toJson methods and fromJson static methods.
  • Updated documentation.

0.4.2 #

  • Added snippets section.
  • Improved documentation.
  • Corrected information in docstring.

0.4.1 #

  • Improved documentation.

0.4.0 #

  • Changed return type of Option.mapOr, Option.mapOrElse, Result.mapOr, Result, mapOrElse to just U.
  • Added Option.mapOrNull, Result.mapOrNull and Result.mapErrOrNull.
  • Added Option.filter.
  • Improved documentation.

0.3.0 #

  • Added Option.unwrapOrNull, Result.unwrapOrNull, and Result.unwrapErrOrNull.
  • Added zipOp.
  • Renamed extensions so that they do not start with Result or Option.
    • When using autocomplete, this way they are less relevant.
  • Removed Option.unwrapOrDefault and Result.unwrapOrDefault, which do not make sense in Dart due to absence of default value.

0.2.3 #

  • Improved examples.

0.2.2 #

  • Added match method to Option and Result.

0.2.1 #

  • Added explanation on how to achieve functionality similar to Rust's From trait for error conversion before propagation.
  • Updated documentation.

0.2.0 #

  • Renamed try operator components.
    • unwrapOrPropagateErr and unwrapOrPropagateNone were renamed to try_.
    • syncErrPropagationScope/asyncErrPropagationScope and syncNonePropagationScope/asyncNonePropagationScope were renamed to syncTryScope/asyncTryScope.
    • Token variable names default to nt and et (previously t for both cases).
  • Renamed from to fromNullable, added toNullable.
  • Updated documentation.

0.1.3 #

  • Improved documentation.

0.1.2 #

  • Improved documentation.
  • Improved docstring.
  • Included e in unwrap's Panic message.
  • Updated toString method of NonePropagation and ErrPropagation.

0.1.1 #

  • Improved documentation.
    • Added "Parallel to Rust's try-operator implementation" subsections.
    • Added "Nested options and comparison to nullable types" subsection.
    • Fixed typos.

0.1.0 #

  • Renamed most classes and methods and static methods. Names are longer, but much more obvious:
    • prop was renamed to unwrapOrPropagateErr and unwrapOrPropagateNone.
    • catchProp/catchPropAsync were renamed to syncErrPropagationScope/asyncErrPropagationScope and syncNonePropagationScope/asyncNonePropagationScope.
    • ResultPropError was renamed to ErrPropagation. Same for OptionPropError, which was renamed to NonePropagation.
    • ResultPropToken was renamed to ErrPropagationToken. Same for OptionPropToken, which was renamed to NonePropagationToken.
  • Added Propagation abstract class.
  • Improved and refactored tests.
  • Improved docstring.
  • Improved README.

0.0.3 #

  • Added try-catch warning to README.
  • Added more code to nidula_example.dart.
  • Small fix to example in README.

0.0.2 #

  • Uploaded again to fix repository URL detection.

0.0.1 #

  • Initial version.
    • Forked from option_result, bringing the following enhancements:
      • Try-operator implementation rewritten from scratch.
        • Compile time safety through propagation tokens.
        • Chainable.
        • Simpler and clearer library-internal error handling strategy.
      • T and E types must extend Object (thus, non-null values are prohibited).
        • This enforces composition with Option types (Option<T>) instead of nullable types (T?).
      • Only T v and E e fields (and, thus, getters) are available.
        • value, val, err and error aliases were removed.
      • There is only a single public library to import components from.
      • Final modifiers to prevent extending Ok, Err, Some and None.
      • == operator takes all generic types into consideration when comparing Option objects and Result objects.
      • Added variable names to all function parameters in types
        • Callback autocomplete outputs e.g. (v) {} instead of (p0) {}
7
likes
160
points
98
downloads

Publisher

verified publishermanuelplavsic.ch

Weekly Downloads

A Dart library for Rust-like Option/Result types. Offers a compile-time safe and chainable parallel to Rust's try operator for None/Err propagation.

Repository
View/report issues

Topics

#option #result #pattern-matching #rust-try-operator

Documentation

API reference

License

MIT (license)

More

Packages that depend on nidula