writeToFile method

dynamic writeToFile(
  1. String content
)

Implementation

writeToFile(String content) {
  //IF FILE PATH IS EMPTY OR NULL THROW AN EXCEPTION
  if (_filePath == null || _filePath == "") {
    throw Exception("File path not set");
  } else {
    //WRITE THE CONTENT TO THE FILE
    _file!.writeAsStringSync(content);
  }
}