INNER CODE UNIT · Dart
ErrorCodeUtils
hyochan/flutter_inapp_purchase · lib/errors.dart:280
class ErrorCodeUtils {
/// Maps a platform-specific error code back to the standardized ErrorCode enum
static ErrorCode fromPlatformCode(
dynamic platformCode,
IapPlatform platform,
) {
// Handle string codes (Android E_* codes or OpenIAP kebab-case)
if (platformCode is String) {
// First try direct mapping from ErrorCodeMapping
const mapping = ErrorCodeMapping.android;
for (final entry in mapping.entries) {
if (entry.value == platformCode) {
return entry.key;
}
}
// If starts with E_, try to normalize and find match
if (platformCode.startsWith('E_')) {