map## 标题文字 ##

  void main(){
    var map1 = {"first":'dart',1:true};
    print(map1);
    print(map1['first']);
    map1[1] = false;
    print(map1);
    var map =  {"first":'dart','second':'java','third':'python'};
    print(map.length);
    print(map.keys);
    print(map.values);
    print(map.containsKey("first"));//是否包含健值是first
    print(map.containsValue('c'));//是否包含值C
    map.remove('first');
    print(map);
    map.forEach(f);
    var list = ['1','1','2'];
    print(list.asMap());//把list 转成 map
  }
  void f(key,value){
    print("key=$key,value=$value");
  }

20200806132633.png

Last modification:August 6th, 2020 at 01:33 pm
如果觉得我的文章对你有用,请随意赞赏