Feature and its Use Cases
Problem
The application records audio consultations and stores them temporarily on the device using path_provider and record. A new audio file is created for every recording session.
Example from lib/main.dart:
final directory = await getTemporaryDirectory();
_recordingPath =
'${directory.path}/recording_${DateTime.now().millisecondsSinceEpoch}.m4a';
This file is later used for transcription:
final file = File(_recordingPath);
if (!await file.exists()) {
return;
}
final bytes = await file.readAsBytes();
final response = await http.post(...);
However, after transcription is completed, the recorded audio file is never deleted.
A search across the repository shows no usage of:
File.delete()
deleteSync()
As a result, each consultation leaves behind a temporary audio file.
Over time, this can lead to:
- accumulation of unused audio files
- unnecessary device storage usage
- degraded app performance due to large temporary storage
Proposed Solution
Delete the temporary audio file after the transcription process finishes.
Example implementation:
try {
final file = File(_recordingPath);
if (await file.exists()) {
await file.delete();
}
} catch (_) {
// ignore cleanup failures
}
This cleanup should occur after transcription completes, regardless of whether the API request succeeds or fails.
Suggested location:
- at the end of
_transcribeAudio() in lib/main.dart
- also in any early-return paths where a file may have been created
Expected Outcome
- Temporary audio files are removed after each transcription
- Device storage remains clean
- Prevents long-term accumulation of unused files
Additional Context
No response
Code of Conduct
Feature and its Use Cases
Problem
The application records audio consultations and stores them temporarily on the device using
path_providerandrecord. A new audio file is created for every recording session.Example from
lib/main.dart:This file is later used for transcription:
However, after transcription is completed, the recorded audio file is never deleted.
A search across the repository shows no usage of:
As a result, each consultation leaves behind a temporary audio file.
Over time, this can lead to:
Proposed Solution
Delete the temporary audio file after the transcription process finishes.
Example implementation:
This cleanup should occur after transcription completes, regardless of whether the API request succeeds or fails.
Suggested location:
_transcribeAudio()inlib/main.dartExpected Outcome
Additional Context
No response
Code of Conduct