optional 4.0.1
optional: ^4.0.1 copied to clipboard
An implementation of the Optional type, which helps avoid dealing with null references
Changelog #
4.0.1 #
- Fixed dartdoc generation
4.0.0 #
- Added
toOptionalextension method - Note that this requires the minimum SDK version to be 2.6.0, please continue to use version 3.1.0 if upgrading to SDK version 2.6.0 is not an option.
3.1.0 #
- Added
contains(val)method. - Added
toSet()method. - Added
toList()method.
3.0.2 #
- Fix Present
cast()issue
3.0.1 #
- Absent
cast()method bug-fix
3.0.0 #
- (Breaking change) Removed operator overloads. They were breaking strong-mode type checks.
- (Breaking change) Made equality checks more consistent with Dart standards. Now any two empty
Optionals are equal, and two non-emptyOptionals are equal if their values are equal, regardless of their types. - Added a
cast()method, similar toList.cast().
2.0.2 #
- Better use of generic methods (no more
dynamic).
2.0.0 #
- Compatibility with Dart 2
1.2.3 #
- Add an optional
orElseparameter toifPresent.
1.2.2 #
Optional.empty()constructor is nowconst.
1.2.1 #
AbsentandPresentare now subclasses ofOptional. You should continue to use constructors inOptional, and not theAbsentorPresentones.EMPTYis now a top-level constant.
1.2.0 #
- Operators are now overloaded, so you can add, subtract, etc., Optionals. Any operation involving an empty Optional will return an empty Optional.
- Added examples.
1.1.0 #
Optional.ofNullable()andOptional.empty()constructors are nowconst.Optional.of()constructor now throwsArgumentErrorwhen passed null, instead ofNoValuePresentError.NoValuePresentErrornow extendsStateError.
1.0.0 #
- Initial release