logExceptionEx static method

Future<String?> logExceptionEx(
  1. Exception exception,
  2. bool nonfatal, {
  3. StackTrace? stacktrace,
  4. Map<String, Object>? segmentation,
})

Report a handled or unhandled exception/error to Countly.

The exception is provided with an Exception object If no stack trace is provided, StackTrace.current will be used

String exception - the exception that is recorded bool nonfatal - reports if the exception was fatal or not StackTrace stacktrace - stacktrace for the crash Map<String, Object> segmentation - allows to add optional segmentation returns error or success message

Implementation

static Future<String?> logExceptionEx(Exception exception, bool nonfatal, {StackTrace? stacktrace, Map<String, Object>? segmentation}) async {
  String exceptionString = exception.toString();
  log('Calling "logExceptionEx":[$exceptionString] nonfatal:[$nonfatal]');
  stacktrace ??= StackTrace.current;
  final result = logException('$exceptionString\n\n$stacktrace', nonfatal, segmentation);
  return result;
}