crash method

Future<bool> crash(
  1. Crash cr
)

Implementation

Future<bool> crash(Crash cr) async {
  if (waitForInternet && !await con.hasInternetAccess) {
    await con.onStatusChange
        .where((event) => event == InternetStatus.connected)
        .first;
  }
  try {
    var resp = await post(
      baseUrl.resolveUri(Uri(path: "/crash")),
      headers: <String, String>{
        "X-API-Key": apiKey,
        "content-type": "application/json",
      },
      body: const JsonEncoder().convert(cr),
    );
    return resp.statusCode == 201;
  } catch (e, stack) {
    if (onError != null) onError!(e, stack);
    return false;
  }
}