Only annotaion @non_null
.
Use it to specify arguments or returned values are not nullable.
You should not give null
to @non_null
annotated arguments.
And you should expect returned values from @non_null
annotated functions or methods.
It expects to be used by linters, source_gen
Generators or something else.
See example/main.dart.
import 'package:non_null/non_null.dart';
@non_null
String foo(@non_null bar) {
return "FOO $bar";
}
void main() {
// `value` is not null (if you believe annotation).
// And DON'T give `null` to foo's argument.
final value = foo("BAR");
print(value);
}
NonNull Annotation by kikuchy is licensed under the Apache License, Version2.0
example/main.dart
library non_null.example;
import 'package:non_null/non_null.dart';
@non_null
String foo(@non_null bar) {
return "FOO $bar";
}
void main() {
// `value` is not null (if you believe annotation).
// And DON'T give `null` to foo's argument.
final value = foo("BAR");
print(value);
}
Add this to your package's pubspec.yaml file:
dependencies:
non_null: ^0.0.1
You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter packages get
Alternatively, your editor might support pub get
or flutter packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:non_null/non_null.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
0.0.1 | Sep 11, 2018 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
30
|
Health:
Code health derived from static analysis.
[more]
|
100
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
70
|
Overall:
Weighted score of the above.
[more]
|
59
|
We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, web, other
No platform restriction found in primary library
package:non_null/non_null.dart
.
Format lib/non_null.dart
.
Run dartfmt
to format lib/non_null.dart
.
Provide a file named CHANGELOG.md
. (-20 points)
Changelog entries help developers follow the progress of your package. See the example generated by stagehand
.
Package is pre-v0.1 release. (-10 points)
While nothing is inherently wrong with versions of 0.0.*
, it might mean that the author is still experimenting with the general direction of the API.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.19.0 <3.0.0 |