Reputation: 157
If have a variable:
Future<CarList?> carList;
I set this variable every couple of seconds via a backend call. In UI, I use FutureBuilder
to show carList
, which works OK. But outside UI, how can I get the value of carList
? Can I just use await carList
, will this always complete?
Upvotes: 0
Views: 37
Reputation: 1
Declare CarList cartList ;
variable globally and assign value it in FutureBuilder, than you can easily access it anywhere in your dart file.
Upvotes: 0