Last active
March 14, 2019 21:40
-
-
Save felipecarvalho/32780de6b46a387d621344f05ed54c63 to your computer and use it in GitHub Desktop.
Filtering values from a object in Dart language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Created by Felipe Carvalho [http://github.com/felipecarvalho] | |
| // You can play with this code on DartPad [https://dartpad.dartlang.org/32780de6b46a387d621344f05ed54c63] | |
| List<Map<String, dynamic>> _fruits = [ | |
| {"id": 0, "name": "Orange"}, | |
| {"id": 1, "name": "Mango"}, | |
| {"id": 2, "name": "Apple"}, | |
| ]; | |
| void main() { | |
| List myFruit = _fruits.where((value) => value['name'] == 'Apple').toList(); | |
| return print('My favorite fruit is ${myFruit[0]['name']}'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment