-
リストの作成とMapの追加
List<Map<String, dynamic>> myList = []; Map<String, dynamic> myMap = { "key1": "value1", "key2": 2, "key3": true, }; myList.add(myMap);
-
リストの初期化と同時にMapを追加
List<Map<String, dynamic>> myList = [ { "key1": "value1", "key2": 2, "key3": true, }, ];
-
リストの指定位置にMapを挿入
List<Map<String, dynamic>> myList = [ { "key1": "value1", "key2": 2, "key3": true, }, { "key4": "value4", "key5": 5, "key6": false, }, ]; Map<String, dynamic> newMap = { "key7": "value7", "key8": 8, "key9": true, }; myList.insert(1, newMap);
-
リスト内のMapの値を更新
List<Map<String, dynamic>> myList = [ { "key1": "value1", "key2": 2, "key3": true, }, ]; myList[0]["key2"] = 3;