sendString method
Sends the specified payload.
Returns true
if sent successfully.
Implementation
@override
Future<bool> sendString(final String payload) async {
final client = config.httpClient();
try {
final response = await client.post(uri, headers: headers, body: payload);
if (response.status != HttpStatus.success) {
throw HttpException(
response.reasonPhrase ?? response.status.name,
uri: uri,
);
}
return true;
} catch (error, stackTrace) {
log('Error sending payload to \'$uri\'', name: 'Rollbar.${runtimeType.toString()}', time: DateTime.now(), level: Level.error.value, error: error, stackTrace: stackTrace);
return false;
} finally {
client.close();
}
}