multiple_result
5.3.0, released 8 months ago by an unverified publisher
A Result type for Dart inspired by dartz's Either and Kotlin's sealed classes.
What it does
Provides a Result type to handle success and error states explicitly in function returns. It includes functional methods like map, flatMap, and tryCatch, as well as an AsyncResult wrapper for handling futures fluently.
AI-written summary of version 5.3.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to return multiple possible outcomes (success or error) from functions explicitly
- You want functional programming helpers like map, flatMap, and tryCatch for error handling
Skip it when
- You prefer throwing exceptions for error management
- You are already using a heavy functional library like dartz that provides its own Either type
Strengths
- Clean and lightweight implementation of the Result pattern
- Leverages Dart 3 sealed classes and extension types for zero-cost async wrappers
- Comprehensive functional methods for transforming and chaining results
Weaknesses
- Does not replace a full-featured functional programming library if you need more monads than Either
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Result<String, Exception> getSomething() {
return Success('Success!');
}Alternatives
Packages that do the same job and could replace multiple_result.
- result_dart
Kotlin and Swift inspired Result class for error handling in Dart and Flutter.
69Compare - dart_either
Either monad for Dart and Flutter supporting type-safe error handling and railway-oriented programming.
81Compare - result_type
A Result type representing success or failure in Dart
50Compare - dart_scope_functions
Kotlin-inspired scope functions like also, let, takeIf, and run for executing code blocks on objects.
74Compare