728x90
반응형
이번 글에서는 where 함수를 사용해 보겠습니다.
void main() {
// 예시로 사용할 List선언
List<Map<String,String>> people =
[
{
'name': '로제',
'group': '블랙핑크',
},
{
'name': '지수',
'group': '블랙핑크',
},
{
'name': 'RM',
'group': 'BTS',
},
];
print(people);
// where 함수를 사용하여 group키의 value값이 블랙핑크인 값만 출력
final blackPink = people.where((x)=> x['group'] == '블랙핑크').toList();
print(blackPink);
}
실행결과
728x90
반응형
'Dart' 카테고리의 다른 글
[ Dart ] Map 알아보기 (0) | 2022.09.14 |
---|---|
[ Dart ] typedef 알아보기 (0) | 2022.09.13 |
[ Dart ] Parameter( positional , optional, named ) 알아보기 (0) | 2022.09.12 |
[ Dart ] dynamic and var 알아보기 (0) | 2022.09.12 |
[ Dart ] Nullable & Non-Nullable 알아보기 (0) | 2022.09.06 |