CSSRule.fromJson constructor

CSSRule.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory CSSRule.fromJson(Map<String, dynamic> json) {
  return CSSRule(
    styleSheetId: json.containsKey('styleSheetId')
        ? StyleSheetId.fromJson(json['styleSheetId'] as String)
        : null,
    selectorList:
        SelectorList.fromJson(json['selectorList'] as Map<String, dynamic>),
    origin: StyleSheetOrigin.fromJson(json['origin'] as String),
    style: CSSStyle.fromJson(json['style'] as Map<String, dynamic>),
    media: json.containsKey('media')
        ? (json['media'] as List)
            .map((e) => CSSMedia.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    containerQueries: json.containsKey('containerQueries')
        ? (json['containerQueries'] as List)
            .map((e) => CSSContainerQuery.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    supports: json.containsKey('supports')
        ? (json['supports'] as List)
            .map((e) => CSSSupports.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    layers: json.containsKey('layers')
        ? (json['layers'] as List)
            .map((e) => CSSLayer.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    scopes: json.containsKey('scopes')
        ? (json['scopes'] as List)
            .map((e) => CSSScope.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
  );
}