setupRawMessageText method

String setupRawMessageText(
  1. Report report
)

Setup raw text email message from report.

Implementation

String setupRawMessageText(Report report) {
  final buffer = StringBuffer();
  if (emailHeader?.isNotEmpty ?? false) {
    buffer
      ..write(emailHeader)
      ..write('\n\n');
  }

  buffer
    ..write('Error:\n')
    ..write(report.error.toString())
    ..write('\n\n');
  if (enableStackTrace) {
    buffer
      ..write('Stack trace:\n')
      ..write(report.stackTrace.toString())
      ..write('\n\n');
  }
  if (enableDeviceParameters) {
    buffer.write('Device parameters:\n');
    for (final entry in report.deviceParameters.entries) {
      buffer.write('${entry.key}: ${entry.value}\n');
    }
    buffer.write('\n\n');
  }
  if (enableApplicationParameters) {
    buffer.write('Application parameters:\n');
    for (final entry in report.applicationParameters.entries) {
      buffer.write('${entry.key}: ${entry.value}\n');
    }
    buffer.write('\n\n');
  }
  if (enableCustomParameters) {
    buffer.write('Custom parameters:\n');
    for (final entry in report.customParameters.entries) {
      buffer.write('${entry.key}: ${entry.value}\n');
    }
    buffer.write('\n\n');
  }
  return buffer.toString();
}