readFileFromPath static method

Future<String> readFileFromPath(
  1. String filePath
)

This method reads the content of the file at the given filePath and returns it as a string.

Implementation

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

  return fileContent;
}