mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-26 00:44:42 +01:00
16 lines
503 B
Dart
16 lines
503 B
Dart
import 'dart:async';
|
|
|
|
extension MapEntryListExtension<T, U> on Iterable<MapEntry<T, U>> {
|
|
Map<T, U> toMap() => Map.fromEntries(this);
|
|
}
|
|
|
|
extension MapExtension<T, U> on Map<T, U> {
|
|
Future<Map<V, W>> asyncMap<V, W>(
|
|
FutureOr<MapEntry<V, W>> Function(T key, U value) convert) async {
|
|
final results = await Future.wait(
|
|
entries.map((e) async => await convert(e.key, e.value)));
|
|
return Map.fromEntries(results);
|
|
}
|
|
|
|
Map<T, U> addedAll(Map<T, U> other) => {...this, ...other};
|
|
}
|