readFile static method

Future<String> readFile(
  1. String fileName
)

This method reads the content of the file with the given fileName in the application documents directory and returns it as a string.

Implementation

static Future<String> readFile(String fileName) async {
  String fileContent = "";
  try {
    File file = File(await getFilePath(fileName));
    fileContent = await file.readAsString();
  } catch (e) {
    rethrow;
  }

  return fileContent;
}