List 是否有一个“问题”;用“开始”;颤振中贴图键的方法?

List 是否有一个“问题”;用“开始”;颤振中贴图键的方法?,list,api,flutter,dictionary,startswith,List,Api,Flutter,Dictionary,Startswith,我是颤振的初学者,我一直致力于将API获取的数据转换为自定义模型。 我使用的API为我提供以下数据: {"meals":[{"idMeal":"52852","strMeal":"Tuna Nicoise","strDrinkAlternate":null,"strCategory":"Seafood", "strArea&qu

我是颤振的初学者,我一直致力于将API获取的数据转换为自定义模型。 我使用的API为我提供以下数据:

{"meals":[{"idMeal":"52852","strMeal":"Tuna Nicoise","strDrinkAlternate":null,"strCategory":"Seafood",
"strArea":"French","strInstructions":"Heat oven to 200C\/fan 180C\/gas 6. Toss the potatoes with 2 tsp oil and some seasoning. Tip onto a large baking tray, then roast for 20 mins, stirring halfway, until crisp, golden and cooked through.\r\nMeanwhile, put eggs in a small pan of water, bring to the boil, then simmer for 8-10 mins, depending on how you like them cooked. Plunge into a bowl of cold water to cool for a few mins. Peel away the shells, then cut into halves.\r\nIn a large salad bowl, whisk together the remaining oil, red wine vinegar, capers and chopped tomatoes. Season, tip in the onion, spinach, tuna and potatoes, then gently toss together. Top with the eggs, then serve straight away.",
"strMealThumb":"https:\/\/www.themealdb.com\/images\/media\/meals\/yypwwq1511304979.jpg","strTags":null,
"strYoutube":"https:\/\/www.youtube.com\/watch?v=3_UAxkx0u6U",
"strIngredient1":"Potatoes","strIngredient2":"Olive Oil","strIngredient3":"Eggs","strIngredient4":"Red Wine Vinegar","strIngredient5":"Capers","strIngredient6":"Sunflower Oil","strIngredient7":"Red Onions","strIngredient8":"Spinach","strIngredient9":"Tuna","strIngredient10":"","strIngredient11":"","strIngredient12":"","strIngredient13":"","strIngredient14":"","strIngredient15":"","strIngredient16":"","strIngredient17":"","strIngredient18":"","strIngredient19":"","strIngredient20":"",
"strMeasure1":"450g","strMeasure2":"2 tblsp ","strMeasure3":"4","strMeasure4":"1 tbls","strMeasure5":"2 tblsp ","strMeasure6":"50g","strMeasure7":"\u00bd","strMeasure8":"100g ","strMeasure9":"400g","strMeasure10":"","strMeasure11":"","strMeasure12":"","strMeasure13":"","strMeasure14":"","strMeasure15":"","strMeasure16":"","strMeasure17":"","strMeasure18":"","strMeasure19":"","strMeasure20":"",
"strSource":"https:\/\/www.bbcgoodfood.com\/recipes\/9529\/winter-tuna-nioise",
"strImageSource":null,"strCreativeCommonsConfirmed":null,"dateModified":null}]}
我想将以“StringCredit”开头的键的所有值存储到一个列表中,“strMeasure”也是如此。


但是我还没有找到一种方法可以实现上述功能。

您可以获得所有
密钥,然后根据您的情况检查每个密钥

Map<String,String> meals= api_data['meals'][0];

List<String> allKeys = meals.keys.toList();

for(String key in allKeys){
  if(key.startsWith("strIngredient")){
    print(meals[key]);
  }
}
Map-fends=api_数据['fends'][0];
List allKeys=founds.keys.toList();
for(所有键中的字符串键){
if(键startsWith(“StringCredit”)){
打印(膳食[钥匙]);
}
}