https://stackoverflow.com/questions/58410482/exposing-all-revenuecat-purchaseserrorcode-codes-in-flutter?sem=2
Expose error codes as enums or equivalent in Dart so they don't have to be hard-coded.
The proposed solution would be to add something like this
enum PurchasesErrorCode {
UnknownError,
PurchaseCancelledError,
StoreProblemError,
PurchaseNotAllowedError,
PurchaseInvalidError,
ProductNotAvailableForPurchaseError,
ProductAlreadyPurchasedError,
ReceiptAlreadyInUseError,
InvalidReceiptError,
MissingReceiptFileError,
NetworkError,
InvalidCredentialsError,
UnexpectedBackendResponseError,
ReceiptInUseByOtherSubscriberError,
InvalidAppUserIdError,
OperationAlreadyInProgressError,
UnknownBackendError,
InsufficientPermissionsError
}
try {
} on PlatformException catch (e) {
PurchasesErrorCode errorCode = PurchasesErrorCode.values[int.parse(e.code)];
switch (errorCode) {
case PurchasesErrorCode.UnknownError:
case PurchasesErrorCode.PurchaseCancelledError:
case PurchasesErrorCode.StoreProblemError:
// Add rest of cases
}
}
https://stackoverflow.com/questions/58410482/exposing-all-revenuecat-purchaseserrorcode-codes-in-flutter?sem=2
Expose error codes as enums or equivalent in Dart so they don't have to be hard-coded.
The proposed solution would be to add something like this