value property

T? get value

Gets the type that is represented as an `IPropertyValue``.

Implementation

T? get value {
  if (ptr.ref.lpVtbl == nullptr) return null;

  switch (_referenceIid) {
    // Handle Int32 types and Int32 enumerations
    case IID_IReference_AdaptiveMediaSourceResourceType:
    case IID_IReference_CaptureSceneMode:
    case IID_IReference_EmailMailboxSmimeEncryptionAlgorithm:
    case IID_IReference_EmailMailboxSmimeSigningAlgorithm:
    case IID_IReference_HdcpProtection:
    case IID_IReference_ManualFocusDistance:
    case IID_IReference_MediaCaptureFocusState:
    case IID_IReference_MediaPlaybackAutoRepeatMode:
    case IID_IReference_MediaPlaybackType:
    case IID_IReference_UserDataTaskWeekOfMonth:
    case IID_IReference_WebErrorStatus:
    case IID_IReference_Int32:
      if (isSubtypeOfWinRTEnum<T>()) return _enumCreator!(getInt32());
      return getInt32() as T;
    // Handle Uint32 types and Uint32 enumerations
    case IID_IReference_BluetoothLEAdvertisementFlags:
    case IID_IReference_UserDataTaskDaysOfWeek:
    case IID_IReference_Uint32:
      if (isSubtypeOfWinRTEnum<T>()) return _enumCreator!(getUInt32());
      return getUInt32() as T;
    case IID_IReference_Boolean:
      return getBoolean() as T;
    case IID_IReference_DateTime:
      return getDateTime() as T;
    case IID_IReference_Double:
      return getDouble() as T;
    case IID_IReference_Float:
      return getSingle() as T;
    case IID_IReference_Guid:
      return getGuid() as T;
    case IID_IReference_Int16:
      return getInt16() as T;
    case IID_IReference_Int64:
      return getInt64() as T;
    case IID_IReference_Point:
      return getPoint() as T;
    case IID_IReference_Rect:
      return getRect() as T;
    case IID_IReference_Size:
      return getSize() as T;
    case IID_IReference_TimeSpan:
      return getTimeSpan() as T;
    case IID_IReference_Uint8:
      return getUInt8() as T;
    case IID_IReference_Uint64:
      return getUInt64() as T;
    // TODO: These structs are not yet supported. Since the PropertyValue does
    // not support them, we need to create our own IReference<T> (and possibly
    // IPropertyValue) implementations for them.
    case IID_IReference_BasicGeoposition:
    case IID_IReference_BitmapBounds:
    case IID_IReference_DisplayPresentationRate:
    case IID_IReference_HolographicStereoTransform:
    case IID_IReference_Matrix4x4:
    case IID_IReference_MseTimeRange:
    case IID_IReference_Quaternion:
    case IID_IReference_SizeInt32:
    case IID_IReference_SpatialBoundingBox:
    case IID_IReference_SpatialBoundingFrustum:
    case IID_IReference_SpatialBoundingOrientedBox:
    case IID_IReference_SpatialRay:
    case IID_IReference_Vector2:
    case IID_IReference_Vector3:
    case IID_IReference_WhiteBalanceGain:
    default:
      throw UnsupportedError('Unsupported IID: $_referenceIid');
  }
}