D. Go.
D. Go.

Reputation: 407

Flutter: Automatically change the data in firebase cloud database after specific time period

Suppose i created a document in cloud firestore and i want that data to be changed after 5 mins of data creation. How can i do that job in dart(framework:flutter).

thanks in advance

Upvotes: 0

Views: 1572

Answers (2)

Jan L
Jan L

Reputation: 261

If you are looking to update your Firestore document at a specific time frequency, you may consider scheduled Cloud Functions. This method of updating documents creates a Google Cloud Pub/Sub topic and Cloud Scheduler to trigger events on that topic, which ensures that your function runs on the desired schedule.

Upvotes: 2

NiiLx
NiiLx

Reputation: 676

You can use Timer for update data after specific time.

Timer _timer;
int _start = 10;

void startTimer() {
  const oneSec = const Duration(seconds: 1);
  _timer = new Timer.periodic(
    oneSec,
    (Timer timer) => setState(
      () {
        if (your logic) {
          //Your code
        } else {
         //Your code
        }
      },
    ),
  );
}

Upvotes: 0

Related Questions