getTranslatedTranscriptFormattedToSave static method

String getTranslatedTranscriptFormattedToSave(
  1. List<TranscriptionModel> transcriptions
)

Implementation

static String getTranslatedTranscriptFormattedToSave(
    List<TranscriptionModel> transcriptions) {
  StringBuffer contentBuffer = StringBuffer();
  for (var entry in transcriptions) {
    if (entry.isFinal) {
      final String textToUse = (entry.translatedTranscription != null &&
              entry.translatedTranscription!.trim().isNotEmpty)
          ? (entry.translatedTranscription ?? "")
          : entry.transcription;

      contentBuffer.writeln('${entry.name} ${entry.timestamp}');
      contentBuffer.writeln(textToUse);
      contentBuffer.writeln();
      contentBuffer.writeln();
    }
  }
  return contentBuffer.toString();
}