IMap<K, V>.fromRawPointer constructor
IMap<K, V>.fromRawPointer (})
Creates an instance of IMap using the given ptr
and iterableIid
.
iterableIid
must be the IID of the IIterable<IKeyValuePair<K, V>>
interface (e.g. IID_IIterable_IKeyValuePair_String_Object).
K
must be of type Guid
, int
, Object
, String
, or WinRTEnum
(e.g. PedometerStepKind
).
V
must be of type Object
, String
, or WinRT
(e.g. IJsonValue
,
ProductLicense
).
creator
must be specified if V
is a WinRT
type.
final map = IMap<String, IJsonValue?>.fromRawPointer(ptr,
creator: IJsonValue.fromRawPointer);
enumCreator
must be specified if V
is a WinRTEnum
type.
final map = IMap<String, ChatMessageStatus>.fromRawPointer(ptr,
enumCreator: ChatMessageStatus.from);
Implementation
IMap.fromRawPointer(
super.ptr, {
required String iterableIid,
V Function(Pointer<COMObject>)? creator,
V Function(int)? enumCreator,
}) : _iterableIid = iterableIid,
_creator = creator,
_enumCreator = enumCreator {
if (!isSupportedKeyValuePair<K, V>()) {
throw ArgumentError('Unsupported key-value pair: IMap<$K, $V>');
}
if (isSubtypeOfInspectable<V>() && creator == null) {
throw ArgumentError.notNull('creator');
}
if (isSubtypeOfWinRTEnum<V>() && enumCreator == null) {
throw ArgumentError.notNull('enumCreator');
}
_iterableCreator = (Pointer<COMObject> ptr) => IKeyValuePair.fromRawPointer(
ptr,
creator: _creator,
enumCreator: _enumCreator);
}