nmap 1.0.0 copy "nmap: ^1.0.0" to clipboard
nmap: ^1.0.0 copied to clipboard

A dart package that provides null map operation extension.

Dart Null Map #

A dart package that provides != null map operation extension (null map, nmap).

The null map operator applies the passed convert function on receiver if it is not null, returns null otherwise.

Note: this package is a temporary solution to the open Dart lang issue https://github.com/dart-lang/language/issues/361 while waiting for an actual language operator implementation.

Usage #

final int? a = null;
final int b = 1;
                                     
print(a.nmap((n) => n + 1)); // null
print(b.nmap((n) => n + 1)); // 2

See implementation file for library source code.

1
likes
150
points
20
downloads

Publisher

verified publishergruvw.com

Weekly Downloads

A dart package that provides null map operation extension.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

More

Packages that depend on nmap