Class 'Future<dynamic>' has no instance method

Viewed 19

I have some code to get files from a json file, only I get a message and not know how to solve that, any ideas?:

List<LatLng> polylineCoordinates = [];

@override
  void initState() {
    polylineCoordinates = readJson().map((e)=> LatLng(e['lat'], e['long'])).tolist();
    super.initState();
  }

The error is:

Class 'Future<dynamic>' has no instance method 'map'.
Receiver: Instance of 'Future<dynamic>'
Tried calling: map(Closure: (dynamic) => LatLng)
0 Answers
Related