1

I wanted to know if there's a way I could get a JSON from a website online, and get to know when the JSON is updated, for example let's say its updated once in every 48 hours, so when the JSON gets updated I can notify the user of a change in the webpage.

An app version of something like https://visualping.io/ does basically.

Arnav
  • 1,276
  • 1
  • 14
  • 30

1 Answers1

1

You can achieve such a task by following these steps:

  • Fetch data from a RestAPI using http get method.
  • Store the data locally
  • Run the same method (which sends the http request to fetch data) at regular intervals of time (48 hours, in your case). How do I run a reoccurring function, in Dart?
  • Make use of state management approaches such as the provider package to listen to the changes in the locally stored data
  • Update the user whenever the provider offers a changed value

I hope it was of any help.

Abbas
  • 725
  • 5
  • 13
  • Will the reoccurring function (Timer widget) work in the background when the app is shut? – Arnav Jan 16 '20 at 13:55