generateFile method
Future<File>
generateFile(
- ReportEvent event, {
- String? fileName,
- Directory? directory,
inherited
Writes the retained JSON to directory or the app's temporary directory.
fileName overrides the name derived from the retained ID and timestamp.
Implementation
@protected
Future<File> generateFile(
ReportEvent event, {
String? fileName,
Directory? directory,
}) async {
final dir = directory ?? await getTemporaryDirectory();
final attachment = ReportAttachment.fromEvent(event, fileName: fileName);
final file = File('${dir.path}${Platform.pathSeparator}${attachment.name}');
await file.parent.create(recursive: true);
return file.writeAsBytes(attachment.bytes, flush: true);
}