INNER CODE UNIT · Dart

toPlatformCode

hyochan/flutter_inapp_purchase · lib/errors.dart:334

  static dynamic toPlatformCode(ErrorCode errorCode, IapPlatform platform) {
    if (platform == IapPlatform.IOS) {
      return ErrorCodeMapping.ios[errorCode] ?? 0;
    } else {
      return ErrorCodeMapping.android[errorCode] ?? 'E_UNKNOWN';
    }
  }

  /// Checks if an error code is valid for the specified platform
  static bool isValidForPlatform(ErrorCode errorCode, IapPlatform platform) {
    if (platform == IapPlatform.IOS) {
      return ErrorCodeMapping.ios.containsKey(errorCode);
    } else {
      return ErrorCodeMapping.android.containsKey(errorCode);
    }
  }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…