simpler toMap

This commit is contained in:
Lukas Lihotzki 2021-07-02 11:18:16 +02:00
parent 0d1e7bdf7b
commit bf3bed9ef9
1 changed files with 2 additions and 5 deletions

View File

@ -32,11 +32,8 @@ extension RoomEncryptedContentBasicEventExtension on BasicEvent {
} }
/// Convert Nullable iterable of MapEntries to Map /// Convert Nullable iterable of MapEntries to Map
extension ToMap<T1, T2> on Iterable<MapEntry<T1, T2>>? { extension ToMap<T1, T2> on Iterable<MapEntry<T1, T2>> {
Map<T1, T2>? toMap() { Map<T1, T2> toMap() => Map.fromEntries(this);
final that = this;
return that != null ? Map.fromEntries(that) : null;
}
} }
class RoomEncryptedContent { class RoomEncryptedContent {