Dev study and notes

[dart] #12 #2.4 Maps (05:38) 본문

studyLog

[dart] #12 #2.4 Maps (05:38)

devlunch4 2023. 5. 2. 05:46
반응형
void main() {
    var player = {
        'name': 'john',
        'xp': 99.99,
        'superpower': false,
    };
    print('player: $player');
    //
    Map<int, bool> mapPlayer = {
        1: true,
        2: false,
        3: true,
    };
    print('\nmapPlayer: $mapPlayer');
    //
    Map<List<int>, bool> listPlayer = {
        [1, 2, 3, 4]: true,
        [5, 6, 7, 8]: false,
    };
    print('\nlistPlayer: $listPlayer');
    //
    List<Map<String, Object>> listMapPlayers = [
        {
          'name': 'john1',
          'xp': 123,
        },
        {
          'name': 'john2',
          'xp': 12345,
        }
    ];
    print('\nlistMapPlayers: $listMapPlayers');
}
// PRINT
// >>>
// player: {name: john, xp: 99.99, superpower: false}
// 
// mapPlayer: {1: true, 2: false, 3: true}
// 
// listPlayer: {[1, 2, 3, 4]: true, [5, 6, 7, 8]: false}
// 
// listMapPlayers: [{name: john1, xp: 123}, {name: john2, xp: 12345}]
반응형

'studyLog' 카테고리의 다른 글

[dart] #14 #3.0 Defining a Function (04:15)  (0) 2023.05.02
[dart] #13 #2.5 Sets (02:16)  (0) 2023.05.02
[dart] #11 #2.3 Collection For (02:27)  (0) 2023.04.29
[dart] #10 #2.2 String Interpolation (04:30)  (0) 2023.04.29
[dart] #9 #2.1 Lists (04:06)  (0) 2023.04.28
Comments