setup static method
Implementation
static void setup(AmazonIapCallbackApi? api, {BinaryMessenger? binaryMessenger}) {
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onUserDataResponse', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onUserDataResponse was null.');
final List<Object?> args = (message as List<Object?>?)!;
final UserDataResponse? arg_data = (args[0] as UserDataResponse?);
assert(arg_data != null,
'Argument for dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onUserDataResponse was null, expected non-null UserDataResponse.');
try {
api.onUserDataResponse(arg_data!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onPurchaseUpdatesResponse', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onPurchaseUpdatesResponse was null.');
final List<Object?> args = (message as List<Object?>?)!;
final PurchaseUpdatesResponse? arg_data = (args[0] as PurchaseUpdatesResponse?);
assert(arg_data != null,
'Argument for dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onPurchaseUpdatesResponse was null, expected non-null PurchaseUpdatesResponse.');
try {
api.onPurchaseUpdatesResponse(arg_data!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onProductDataResponse', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onProductDataResponse was null.');
final List<Object?> args = (message as List<Object?>?)!;
final ProductDataResponse? arg_data = (args[0] as ProductDataResponse?);
assert(arg_data != null,
'Argument for dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onProductDataResponse was null, expected non-null ProductDataResponse.');
try {
api.onProductDataResponse(arg_data!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onPurchaseResponse', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onPurchaseResponse was null.');
final List<Object?> args = (message as List<Object?>?)!;
final PurchaseResponse? arg_data = (args[0] as PurchaseResponse?);
assert(arg_data != null,
'Argument for dev.flutter.pigeon.amazon_iap.AmazonIapCallbackApi.onPurchaseResponse was null, expected non-null PurchaseResponse.');
try {
api.onPurchaseResponse(arg_data!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
}