initLogFile method
Implementation
Future<void> initLogFile() async {
Directory directory = await getApplicationDocumentsDirectory();
String path = directory.path + '/app_logs.txt';
logFile = File(path);
// Create the file if it doesn't exist
if (!(await logFile!.exists())) {
await logFile!.create();
}
}