mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-08 18:08:07 -06:00
10 lines
227 B
Dart
10 lines
227 B
Dart
extension NullableMapKey<K, V> on Map<K, V> {
|
|
V? tryPutIfAbsent(K key, V? Function() ifAbsent) {
|
|
final value = ifAbsent();
|
|
if (value == null) {
|
|
return null;
|
|
}
|
|
return putIfAbsent(key, () => value);
|
|
}
|
|
}
|