Search code examples
flutterdartflutter-file

How to update the Existing File (Path_Provider) in Flutter


I have a question about path_provider package, i'm fetching the api data and once i received the data i cache the json data in File. How can i update the existing file, Because whenever i got any changes or updates in api data then it doesn't make any update or refresh on cache file data. Is there any articles or documents or videos to show how to update the existing file?


Solution

  • You can just add

    File(path).deleteSync(recursive: true);
    

    to delete the existing file then recreate it as it's a new.