Flutter and Json Retrieve a Title where value is


Staff member
I have a Json array that is from wordpress. It retrives posts.
Each post has a serie of custom_options.

here an example:


What I am trying to do is to call a function that will return the title of a given value.

Already tried using

// infoList is the json object
// resultVal is the value I am searching for
String getarrayinfos (infoList, resultVal) {
    var result;
    Map thisList = infoList;

    for(var eachArr in thisList.keys){
      if(thisList[eachArr]["value"] == resultVal){
        result = thisList[eachArr]["title"];

    return result.toString();

and printing it as the child of a container

// options is the json Object
// S7 is the value I am searching for 
child: Text(getarrayinfos(options, "S7")),

but it prints the following error

flutter: type 'String' is not a subtype of type 'int' of 'index'

What am I doing wrong?