IReference<T>.fromRawPointer constructor

IReference<T>.fromRawPointer(
  1. Pointer<COMObject> ptr, {
  2. required String referenceIid,
  3. T enumCreator(
    1. int
    )?,
})

Creates an instance of IReference using the given ptr and referenceIid.

referenceIid must be the IID of the IReference<T> interface (e.g. IID_IReference_Uint32).

T must be of type DateTime, double, Duration, int, String, Struct (e.g. Guid,Point, Rect, Size), or WinRTEnum (e.g. WebErrorStatus).

enumCreator must be specified if T is a WinRTEnum type.

final reference = IReference<WebErrorStatus>.fromRawPointer(ptr,
    enumCreator: WebErrorStatus.from);

Implementation

IReference.fromRawPointer(super.ptr,
    {required String referenceIid, T Function(int)? enumCreator})
    : _referenceIid = referenceIid,
      _enumCreator = enumCreator {
  if (isSubtypeOfWinRTEnum<T>() && enumCreator == null) {
    throw ArgumentError.notNull('enumCreator');
  }
}