Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gruvw/nmap
A dart package that provides `!= null` map operation extension (null map, nmap).
https://github.com/gruvw/nmap
dart dartlang flutter null-safety
Last synced: 28 days ago
JSON representation
A dart package that provides `!= null` map operation extension (null map, nmap).
- Host: GitHub
- URL: https://github.com/gruvw/nmap
- Owner: gruvw
- License: gpl-3.0
- Created: 2024-08-28T20:06:27.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-04T11:06:45.000Z (4 months ago)
- Last Synced: 2024-12-06T18:03:15.775Z (about 1 month ago)
- Topics: dart, dartlang, flutter, null-safety
- Language: Dart
- Homepage: https://pub.dev/packages/nmap
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Dart Null Map
A dart package that provides `!= null` map operation extension (null map, `nmap`).
**Check it out** (install) on pub.dev:
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 while waiting for an actual language operator implementation.
## Usage
```dart
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](./lib/src/nmap_base.dart) for library source code.