CSSMedia.fromJson constructor

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

Implementation

factory CSSMedia.fromJson(Map<String, dynamic> json) {
  return CSSMedia(
    text: json['text'] as String,
    source: CSSMediaSource.fromJson(json['source'] as String),
    sourceURL:
        json.containsKey('sourceURL') ? json['sourceURL'] as String : null,
    range: json.containsKey('range')
        ? SourceRange.fromJson(json['range'] as Map<String, dynamic>)
        : null,
    styleSheetId: json.containsKey('styleSheetId')
        ? StyleSheetId.fromJson(json['styleSheetId'] as String)
        : null,
    mediaList: json.containsKey('mediaList')
        ? (json['mediaList'] as List)
            .map((e) => MediaQuery.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
  );
}