CSS constructor

CSS([
  1. Object? css
])

Implementation

factory CSS([Object? css]) {
  if (css == null) return CSS._();

  if (css is CSS) return css;

  if (css is String) {
    return CSS.parse(css) ?? CSS._();
  } else if (css is List) {
    var listStr = css.map((e) => parseString(e)).whereType<String>().toList();
    return CSS.parseList(listStr) ?? CSS._();
  }

  throw StateError("Can't parse CSS: $css");
}