Tag constructor

Tag(
  1. String name,
  2. String rawTag,
  3. Map<String, dynamic> properties,
  4. bool isStart,
  5. int size,
)

creates a new tag-representation. and decodes the "style" tag if present

Implementation

Tag(this.name, this.rawTag, this.properties, this.isStart, this.size) {
  if (properties.containsKey("style")) {
    String styleProp = this.properties["style"];
    List<String> properties = styleProp.split(";");

    for (String property in properties) {
      List<String> parts = property.split(":");
      String key = parts[0].trim();
      if (key.isEmpty) continue;

      String value = parts.length == 2 ? parts[1].trim() : "";
      styleProperties[key] = value;
    }
  }
}