v0.3.0
- Inverted
onSome
andonNone
functions parameters inmatch
method ofOption
[⚠️ BREAKING CHANGE] (Read more on why 👉 #56)
/// Everywhere you are using `Option.match` you must change this:
final match = option.match(
(a) => print('Some($a)'),
() => print('None'), // <- `None` second 👎
);
/// to this (invert parameters order):
final match = option.match(
() => print('None'), // <- `None` first 👍
(a) => print('Some($a)'),
);
- Added
traverse
andsequence
methods (#55)traverseList
traverseListWithIndex
sequenceList
traverseListSeq
traverseListWithIndexSeq
sequenceListSeq
/// "a40" is invalid 💥
final inputValues = ["10", "20", "30", "a40"];
/// Verify that all the values can be converted to [int] 🔐
///
/// If **any** of them is invalid, then the result is [None] 🙅♂️
final traverseOption = inputValues.traverseOption(
(a) => Option.tryCatch(
/// If `a` does not contain a valid integer literal a [FormatException] is thrown
() => int.parse(a),
),
);
- Added
bindEither
method inTaskEither
(#58)
/// Chain [Either] to [TaskEither]
TaskEither<String, int> binding =
TaskEither<String, String>.of("String").bindEither(Either.of(20));
- Added
lefts
,rights
, andpartitionEithers
methods toEither
(#57)
final list = [
right<String, int>(1),
right<String, int>(2),
left<String, int>('a'),
left<String, int>('b'),
right<String, int>(3),
];
final result = Either.partitionEithers(list);
expect(result.first, ['a', 'b']);
expect(result.second, [1, 2, 3]);
- Added
bimap
method toEither
,IOEither
, andTuple2
(#57) - Added
mapLeft
method toIOEither
(#57) - Added
fold
method toOption
(same asmatch
) (#56) - Fixed
chainFirst
forEither
,TaskEither
, andIOEither
when chaining on a failure (Left
) (#47) by DevNico 🎉 - Added
const
to all constructors in which it was missing (#59) - Minimum environment dart sdk to
2.17.0
⚠️
environment:
sdk: ">=2.17.0 <3.0.0"
-
Updated README and documentation
-
Testing improvements (internal)
- Added testing utils
- Added Property-based testing using
glados
- Fixed tests for
match()
method by addingfail
in unexpected matched branch
-
Contribution improvements
- Added testing workflow with Github actions (#54)