subscription method
Implementation
@override
Future<void> subscription({
required SubscriptionRequest subscription,
}) async {
final payload = subscriptionToJson(subscription);
final resp = await http.post(
Uri.parse(AppConstants.baseUrl + '/subscription/'),
headers: {
HttpHeaders.acceptHeader: 'application/json',
'Content-Type': 'application/json',
if (keyAuthorization.isNotEmpty)
'Authorization': 'key=$keyAuthorization'
},
body: payload,
);
if (InngageProperties.getDebugMode()) {
logger.i(resp.request);
logger.i(resp.body);
}
if (InngageProperties.getDebugMode()) {
debugPrint('INNGAGE PAYLOAD: $payload');
debugPrint('INNGAGE RESPONSE: ${resp.body}');
}
if (resp.statusCode != 200) {
debugPrint('Unfortunately it was not possible to subscribe');
}
return;
}