exportLogsToFile method
Exports both simple and network logs to JSON and triggers native share dialog.
Implementation
Future<String> exportLogsToFile() async {
final simple = await _storage.getSimpleLogs();
final network = await _storage.getNetworkLogs();
final Map<String, dynamic> json = {
"simple_logs": simple.map((e) => e.toJson()).toList(),
"network_logs": network.map((e) => e.toJson()).toList(),
};
final dir = await getTemporaryDirectory();
final file = File(
'${dir.path}/exported_logs_${DateTime.now().millisecondsSinceEpoch}.json');
await file.writeAsString(jsonEncode(json));
return file.path;
}