StyleProperty.fromStyleString constructor
StyleProperty.fromStyleString(
- String styleString
Decodes a style string to a specific map. This string can look like the following value: "font-size:12;color:#ffffff"
Implementation
factory StyleProperty.fromStyleString(String styleString) {
Map<String, dynamic> styleProperties = {};
List<String> sParts = styleString.split(";");
for (String property in sParts) {
List<String> parts = property.split(":");
String key = parts[0].trim();
String value = parts.length == 2 ? parts[1].trim() : "";
if (key.isNotEmpty && value.isNotEmpty) styleProperties[key] = value;
}
return StyleProperty._(styleProperties);
}