IMap<K, V> constructor

IMap<K, V>()

Creates an empty IMap.

K must be of type Guid or String and V must be of type Object? or String.

Implementation

factory IMap() {
  if (isSameType<K, Guid>() && isSimilarType<V, Object>()) {
    return IMap.fromRawPointer(MediaPropertySet().ptr,
        iterableIid: IID_IIterable_IKeyValuePair_Guid_Object);
  }

  if (isSameType<K, String>()) {
    if (isSameType<V, String>()) {
      return IMap.fromRawPointer(StringMap().ptr,
          iterableIid: IID_IIterable_IKeyValuePair_String_String);
    }

    if (isSimilarType<V, Object>()) {
      return IMap.fromRawPointer(PropertySet().ptr,
          iterableIid: IID_IIterable_IKeyValuePair_String_Object);
    }
  }

  throw ArgumentError('Unsupported key-value pair: IMap<$K, $V>');
}