create method

Properties create (Map<String, dynamic> values, { bool addNonExisting: true })

Implementation

Properties create(Map<String,dynamic> values,{bool addNonExisting = true}) {
  Properties properties = new Properties([]);
  List<String> added = [];
  this.contents.forEach((e) {
    if(e is PropertiesComment) {
      properties.contents.add(e);
    }
    else if(e is PropertiesTemplateEntry) {
      properties.contents.add(new PropertiesEntry(e.key, values[e.key]));
      added.add(e.key);
    }
  });

  if(addNonExisting) {
    values.forEach((k,v) {
      properties.contents.add(new PropertiesEntry(k, v));
    });
  }

  return properties;
}