addCrashLog static method

Future<String?> addCrashLog(
  1. String logs
)

add logs to your crash report. You can leave crash breadcrumbs which would describe previous steps that were taken in your app before the crash. They will be sent together with the crash report if the app crashes. returns the error or success message

Implementation

static Future<String?> addCrashLog(String logs) async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "addCrashLog"';
    log('addCrashLog, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  log('Calling "addCrashLog":[$logs]');
  if (logs.isEmpty) {
    String error = "addCrashLog, Can't add a null or empty crash logs";
    log(error);
    return 'Error : $error';
  }
  List<String> args = [];
  args.add(logs);

  final String? result = await _channel.invokeMethod('addCrashLog', <String, dynamic>{'data': json.encode(args)});

  return result;
}