finalize method
End Play Store connection on Android
and remove iap observer in iOS
.
Absolutely necessary to call this when done with the payment.
Implementation
Future<String?> finalize() async {
if (_platform.isAndroid) {
final String? result = await _channel.invokeMethod('endConnection');
_removePurchaseListener();
return result;
} else if (_platform.isIOS) {
final String? result = await _channel.invokeMethod('endConnection');
_removePurchaseListener();
return result;
}
throw PlatformException(
code: _platform.operatingSystem, message: "platform not supported");
}