saveLogs function

Future<XFile> saveLogs(
  1. List<AliceHttpCall> logs
)

Implementation

Future<XFile> saveLogs(List<AliceHttpCall> logs) async {
  final callStrings = await Future.wait(
      logs.map((log) async => await AliceSaveHelper.buildCallLog(log)));

  final String logsString = callStrings.fold('', (value, log) {
    if (value.isEmpty) {
      return log;
    }
    return "$value\n\n\n$log";
  });

  final bytes = Uint8List.fromList(logsString.codeUnits);
  final file = XFile.fromData(bytes);

  return file;
}