toJson method

Map<String, dynamic> toJson({
  1. bool enableDeviceParameters = true,
  2. bool enableApplicationParameters = true,
  3. bool enableStackTrace = true,
  4. bool enableCustomParameters = false,
})

Creates json from current instance

Implementation

Map<String, dynamic> toJson({
  bool enableDeviceParameters = true,
  bool enableApplicationParameters = true,
  bool enableStackTrace = true,
  bool enableCustomParameters = false,
}) {
  final json = <String, dynamic>{
    'error': error.toString(),
    'customParameters': customParameters,
    'dateTime': dateTime.toIso8601String(),
    'platformType': platformType.name,
  };
  if (enableDeviceParameters) {
    json['deviceParameters'] = deviceParameters;
  }
  if (enableApplicationParameters) {
    json['applicationParameters'] = applicationParameters;
  }
  if (enableStackTrace) {
    json['stackTrace'] = stackTrace.toString();
  }
  if (enableCustomParameters) {
    json['customParameters'] = customParameters;
  }
  return json;
}