Gokul Sundar
Gokul Sundar

Reputation: 375

How to convert Future<List<Object>> to List<Object>?

i'm getting values from API and it's in a Future<List<Object>> form how do i convert into List<Objects>?

i already tried using Future Builder but it recursively return NoDataDialog Widget.

Upvotes: 0

Views: 260

Answers (1)

wcyankees424
wcyankees424

Reputation: 2654

There are two ways to deal with async functions

1st

_asyncFunction() async {
  List list = await futureList;
}

2nd

_asyncFunction() {

  Future.delayed(Duration(seconds: 10), () {
      //this executes
    }).then((_) {
      //then this
    });
}

Upvotes: 2

Related Questions