type ‘String’ is not a subtype of type ‘int’ of ‘index’ while getting location API from openweathermap

The API output is a string.

Firstly import ‘dart:convert’;

And wrap your API output in jsonDecode( API_OUTPUT ).

That’ll make it into a json object whose contents can then be accessed in the way that you are doing.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top