I have this list
[
{game29HakakianSchopf: {assists: 0, points: 0, rebounds: 0, fouls: 3}},
{game30HakakianSchopf: {assists: 0, points: 0, rebounds: 0, fouls: 3}}
]
How can I use indexWhere in dart to find the index that contains the key (for example, find the index that has the key 'game29HakakianSchopf')
CodePudding user response:
Try something like this,
var a = [
{game29HakakianSchopf: {assists: 0, points: 0, rebounds: 0, fouls: 3}},
{game30HakakianSchopf: {assists: 0, points: 0, rebounds: 0, fouls: 3}}
];
final index = a.indexWhere((item){
return item.keys.first.toString() == "game29HakakianSchopf";
});