ReportAttachment.fromEvent constructor
ReportAttachment.fromEvent(
- ReportEvent event, {
- String? fileName,
Encodes the payload retained by ReportEvent.toMap as UTF-8 JSON.
The default name uses only the ID and timestamp retained in that payload.
A nonblank fileName overrides it. Both names are sanitized for use as a
single file name and end in .json. Long names are shortened at a Unicode
character boundary to fit within 255 UTF-8 bytes.
Implementation
ReportAttachment.fromEvent(ReportEvent event, {String? fileName})
: name = fileName == null || fileName.trim().isEmpty
? defaultReportFileName(event)
: jsonFileName(fileName.trim()),
_bytes = utf8.encode(event.toJson());