getFileAsString method

String getFileAsString()

Reads and returns the whole file as a string.

Throws if the path was not set with setFilePath.

Implementation

String getFileAsString() {
  if (_filePath == null || _filePath == "") {
    throw Exception("File path not set");
  } else {
    return _file!.readAsStringSync();
  }
}