sendReport method

Future<Response> sendReport (
  1. {@required String accessToken,
  2. @required String message,
  3. @required List<RollbarTelemetry> telemetry,
  4. Map clientData,
  5. RollbarPerson person,
  6. String environment}
)

Implementation

Future<http.Response> sendReport({@required String accessToken, @required String message, @required List<RollbarTelemetry> telemetry, Map clientData, RollbarPerson person, String environment}) {
  return _client.post(
    'https://api.rollbar.com/api/1/item/',
    body: json.encode(
      {
        'access_token': accessToken,
        'data': {
          'environment': environment,
          'platform': Platform.isAndroid ? 'android' : 'ios',
          'framework': 'flutter',
          'language': 'dart',
          'body': {
            'message': {
              'body': message,
            },
            'telemetry': telemetry.map((item) => item.toJson()).toList(),
          },
          'person': person?.toJson(),
          'client': clientData,
          'notifier': {
            'name': 'flutter_rollbar',
            'version': '0.0.1+1',
          }
        }
      },
    ),
  );
}