readFile static method

Future<String> readFile(
  1. File file
)

Return the contents of the specified file. Pass the File object

Implementation

static Future<String> readFile(File file) async {
  String contents;
  try {
    // Read the file
    contents = await file.readAsString();
  } catch (e) {
    // If we encounter an error
    contents = '';
  }
  return contents;
}