IMapView<K, V>.fromRawPointer constructor
IMapView<K, V>.fromRawPointer (})
Creates an instance of IMapView 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 mapView = IMapView<String, IJsonValue?>.fromRawPointer(ptr,
creator: IJsonValue.fromRawPointer);
enumCreator
must be specified if V
is a WinRTEnum
type.
final mapView = IMapView<String, ChatMessageStatus>.fromRawPointer(ptr,
enumCreator: ChatMessageStatus.from);
Implementation
IMapView.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: IMapView<$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);
}