skip to Main Content

I have an API that is related to digital currency rates
How can it be displayed in real time? I want the data to be displayed whenever the exchange rate changes.

I would like to use a timer that requests every 1 second.
Thankful

2

Answers


  1. Try it like this: apiCallFunction will be your API request.

    import 'dart:async';
    void main(){
      const oneSec = Duration(seconds:1);
      Timer.periodic(oneSec, (Timer t) => apiCallFunction());
    }
    
    Login or Signup to reply.
  2. To get real-time data and update from API, you must use "web socket API", which you can get from the backend developer who made the API

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search