- Update source file formatting
- I've finally learned to appreciate dart format
- Add
FutureOption<T>
typedef. - Add
FutureOrOption<T>
typedef. - Add
FutureResult<T, E>
typedef. - Add
FutureOrResult<T, E>
typedef.
- Fix code snippet in readme.
- Clean up
flatten()
implementations. - Add source links to docs.
- Update README.
- Add
value
field shorthand getters forOption
types. - Add
value
field shorthand getters forResult
types.
- Fix README formatting.
- Add
call()
extension for the following types to allow calling them like a function for easy unwrapping of theirOption
/Result
values:Future<Option<T>>
FutureOr<Option<T>>
Future<Result<T, E>>
FutureOr<Result<T, E>>
- Remove deprecated
~
operator forOption
andResult
type values. - Remove
~
operator forResult<(), E>
type values.-
The only reason this was added was to keep
~await failableOperation()
ergonomic, but this can be accomplished with acall()
extension onFuture
/FutureOr
values which keeps the quick method of unwrappingOption
/Result
values consistent accross the library.~a + ~b
becamea() + b()
~optionFn()
becameoptionFn()()
~resultFn()
becameresultFn()()
and now:~await optionFnAsync()
becomesawait optionFnAsync()()
~await resultFnAsync()
becomesawait resultFnAsync()()
-
- Un-deprecate
~
operator forResult<(), E>
type values- This keeps the ergonomics of
~
for unwrapping awaited Results, but only where the value would be discarded anyway, i.e., unwrapping a result that is only used for error handling inside acatchResult
orcatchResultAsync
block so that the error can propagate.
- This keeps the ergonomics of
- Add
Option.call()
to allow callingOption
values like a function to unwrap their held values. - Add
Result.call()
to allow callingResult
values like a function to unwrap their held values.
- Deprecated
~
operators forOption
andResult
types.- Use
Option/Result.call()
asvalue()
to unwrap with minimal syntax instead.- This prevents the need for accommodating operator precedence when unwrapping
Option
/Result
values which provides a more ergonomic experience when accessing values/methods on the unwrapped value is needed.
- This prevents the need for accommodating operator precedence when unwrapping
- Use
- Remove work-in-progress message from readme.
- How did I miss this?
- help
- How did I miss this?
- Remove
~
shortcut for prefixing Option/Result propagation functions.-
I failed to test the most obvious use-case. Due to the lack of generics on operators, when both variants of
Option
orResult
are returned in the same prefixed function, the return type is inferred by the compiler to beObject
and the propagation extensions then fail to recognize the function as a valid target for the~
operator.To compensate, I made the Option/Result propagation helpers easier to type by renaming them, saving 4 characters and 2 syllables. It's the best I can think of until such time that Dart supposed fully generic operator definitions.
-
- Rename
propagateOption()
->catchOption()
. - Rename
propagateResult()
->catchResult()
. - Rename
propagateOptionAsync()
->catchOptionAsync()
. - Rename
propagateResultAsync()
->catchResultAsync()
.
- Final documentation update for 1.0.0 release. 🎉
- Update documentation.
- Allow
const
Option
andResult
values. - Rename
Option#filter()
->Option#where()
.- This is more Dart-idiomatic.
- Add
Option#iter()
. - Add
Result#iter()
.
- Add
Option#toString()
. - Add
Result#toString()
. - Rework
==
forOption
andResult
types.- Previously
==
would check for matching runtime types in addition to held value equality. I was trying to keep things as close to Rust's behavior as I could. It didn't occur to me until after I rewrote it to be more accommodating ofdynamic
values that it didn't support comparing held values that inherit from eachother that might normally be comparable in both the original implementation and the rewrite so I scrapped both in favor of solely comparing held values.
- Previously
- Add
Result#transpose()
,ok()
,err()
.
- Add
Option#unwrapOrElse()
,okOr()
,okOrElse()
,transpose()
. - Add
Result#unwrapOrElse()
,isOkAnd()
,isErrAnd()
,mapOr()
,mapOrElse()
.
- Add
Option#inspect()
,xor()
,isSomeAnd()
,mapOr()
,mapOrElse()
. - Add
Result#inspect()
,inspectErr()
.
- Add
Option#flatten()
. - Add
Result#flatten()
. - Refactor
~
shortcut forpropagateResult/Async
to return dynamic for ergonomics.- See documentation for more information.
- Add
~
operator for unwrappingOption
andResult
types. - Add
~
operator as shortcut for propagatingNone()
/Err()
in functions returningOption
/Result
. - Rework
Option#unzip()
via extension methods to only provide the method onOption<(T, U)>
values.
- Add
Option#and()
,andThen()
,or()
,orElse()
,expect()
. - Add
Result#and()
,andThen()
,or()
,orElse()
,expect()
,expectErr()
.
- Add
Option#map()
,zip()
,zipWith()
,unzip()
. - Add
Result#map()
,mapErr()
. - Reworked
propagateResult/Async
semantics to be more in-line with Rust'sResult
Err
propagation.
- Add separate packages to allow importing
option
andresult
separately. - Add
Option#filter()
method.
- Initial version.