result_handler 1.2.0
result_handler: ^1.2.0 copied to clipboard
A simple and powerful library for handling results (successes and failures) in Dart, inspired by Either from functional programming libraries like dartz.
1.0.0 #
- First release.
1.0.1 #
- Edit description.
1.0.2 #
- Edit readme.
1.2.0 #
Changed #
- Reversed Generic Type Parameters in
ResultClass Hierarchy:- The generic type parameters in the
Resultabstract class and its concrete subclasses,FailureandSuccess, have been reversed. - Previous:
Result<Success, Error> - New:
Result<Error, Success> - This change affects the following classes and their method signatures:
abstract class Result<E, T>class Failure<E, T> extends Result<E, T>class Success<E, T> extends Result<E, T>
- Impact:
- The order of type parameters when creating
Result,Failure, andSuccessinstances is nowResult<ErrorType, SuccessType>. - All methods in these classes that used
TandEhave been updated to reflect the change.
- The order of type parameters when creating
- Reason:
- Aligns with the common functional programming convention of specifying error type first and success type second in result types.
- Provides a more intuitive mental model for developers when dealing with potential failures.
- Migration:
- Existing code utilizing the
Resultclass will need to update their generic type parameters accordingly (e.g.,Result<int, String>becomesResult<String, int>). - No functionality is changed other than type parameter order, so the code should work the same way after the fix, providing the types are updated correctly.
- Existing code utilizing the
- The generic type parameters in the