getCrashLogs method

Future<List<File>> getCrashLogs()

Implementation

Future<List<File>> getCrashLogs() async {
  final directory = await getExternalStorageDirectory();
  if (directory == null) return [];

  final logFiles = directory
      .listSync()
      .where((file) {
        return file.path.endsWith('.txt');
      })
      .map((file) => File(file.path))
      .toList();

  return logFiles;
}