fabrik_result 0.1.1
fabrik_result: ^0.1.1 copied to clipboard
A lightweight toolkit for functional-style types like Either, built for clarity and real-world use.
fabrik_result #
A minimal and lightweight result-handling toolkit for real-world Dart and Flutter apps.
This package provides:
- A sealed
Either<L, R>
type to model success/failure without using try-catch - A
Unit
type to represent a typedvoid
for functional-style APIs
Philosophy #
fabrik_result
is built for clarity, simplicity, and real usage in domain-driven apps.
It provides only what you need, making it extremely lightweight.
Installation #
dart pub add fabrik_result
Usage #
Either #
Either<Failure, User> result = await getUser();
result.fold(
(failure) => handleError(failure),
(user) => handleSuccess(user),
);
Unit #
Either<Failure, Unit> result = await save();
result.fold(
(failure) => showError(failure),
(_) => showSuccessToast(),
);