trustLevel property

TrustLevel get trustLevel

Gets the trust level of the current Windows Runtime object.

Implementation

TrustLevel get trustLevel {
  final pTrustLevel = calloc<Int32>();

  try {
    final hr = getTrustLevel(pTrustLevel);
    if (SUCCEEDED(hr)) {
      switch (pTrustLevel.value) {
        case 0:
          return TrustLevel.baseTrust;
        case 1:
          return TrustLevel.partialTrust;
        case 2:
          return TrustLevel.fullTrust;
        default:
          throw ArgumentError('GetTrustLevel returned an unexpected value.');
      }
    } else {
      throw WindowsException(hr);
    }
  } finally {
    free(pTrustLevel);
  }
}