readFileAsLines function

Future<List<String>?> readFileAsLines(
  1. String filePath
)

Reads the contents of the file located at filePath as a list of lines.

Implementation

Future<List<String>?> readFileAsLines(String filePath) async {
  try {
    final localSystemFilePath = toLocalSystemPathFormat(filePath);
    final file = File(localSystemFilePath);
    final lines = await file.readAsLines();
    return lines;
  } catch (_) {
    return null;
  }
}