Optional.dart is an implementation of the
Optional type, inspired by Java 8's Optional class.
Optional.empty()constructor is now
Presentare now subclasses of
Optional. You should continue to use constructors in
Optional, and not the
EMPTYis now a top-level constant.
Optional.empty()constructors are now
Optional.of()constructor now throws
ArgumentErrorwhen passed null, instead of
Add this to your package's pubspec.yaml file:
dependencies: optional: "^1.2.3+1"
You can install packages from the command line:
$ pub get
$ flutter packages get
Alternatively, your editor might support
pub get or
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|1.2.3+1||Dec 15, 2015|
|1.2.3||Dec 15, 2015|
|1.2.2||Oct 2, 2014|
|1.2.1+4||Sep 14, 2014|
|1.2.1+3||Sep 12, 2014|
|1.2.1+2||Sep 12, 2014|
|1.2.1+1||Sep 12, 2014|
|1.2.1||Sep 8, 2014|
|1.2.0||Aug 22, 2014|
|1.1.0||Aug 22, 2014|
We analyzed this package, and provided a score, details, and suggestions below.
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Detected platforms: Flutter, server, web
No platform restriction found in libraries.
Strong-mode analysis of
lib/src/present.dartfailed with the following error:
line: 14 col: 17
The return type 'Absent' isn't a 'Optional<T>', as defined by the method 'filter'.
Fix issues reported by
dartanalyzerreported 1 error(s) and 0 warning(s).
The description is too short.
Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.
Maintain an example.
None of the files in your
example/directory matches a known example patterns. Common file name patterns include:
example.dartor you could also use