from<V extends CSSValue> static method
Implementation
static CSSEntry<V>? from<V extends CSSValue>(
String name,
Object? value, [
String? comment,
]) {
if (value == null) return null;
if (value is CSSEntry) {
// Keep the comment of the source entry:
return CSSEntry<V>(
name,
value.value as V?,
comment: comment ?? value._comment,
);
} else if (value is CSSValue) {
return CSSEntry<V>(name, value as V, comment: comment);
} else if (value is String) {
var cssValue = CSSValue.parseByName(value, name);
return CSSEntry<V>(name, cssValue as V, comment: comment);
}
return null;
}