WebAppManifest.fromJson constructor

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

Implementation

factory WebAppManifest.fromJson(Map<String, dynamic> json) {
  return WebAppManifest(
    backgroundColor: json.containsKey('backgroundColor')
        ? json['backgroundColor'] as String
        : null,
    description: json.containsKey('description')
        ? json['description'] as String
        : null,
    dir: json.containsKey('dir') ? json['dir'] as String : null,
    display: json.containsKey('display') ? json['display'] as String : null,
    displayOverrides: json.containsKey('displayOverrides')
        ? (json['displayOverrides'] as List).map((e) => e as String).toList()
        : null,
    fileHandlers: json.containsKey('fileHandlers')
        ? (json['fileHandlers'] as List)
            .map((e) => FileHandler.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    icons: json.containsKey('icons')
        ? (json['icons'] as List)
            .map((e) => ImageResource.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    id: json.containsKey('id') ? json['id'] as String : null,
    lang: json.containsKey('lang') ? json['lang'] as String : null,
    launchHandler: json.containsKey('launchHandler')
        ? LaunchHandler.fromJson(
            json['launchHandler'] as Map<String, dynamic>)
        : null,
    name: json.containsKey('name') ? json['name'] as String : null,
    orientation: json.containsKey('orientation')
        ? json['orientation'] as String
        : null,
    preferRelatedApplications: json.containsKey('preferRelatedApplications')
        ? json['preferRelatedApplications'] as bool
        : null,
    protocolHandlers: json.containsKey('protocolHandlers')
        ? (json['protocolHandlers'] as List)
            .map((e) => ProtocolHandler.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    relatedApplications: json.containsKey('relatedApplications')
        ? (json['relatedApplications'] as List)
            .map(
                (e) => RelatedApplication.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    scope: json.containsKey('scope') ? json['scope'] as String : null,
    scopeExtensions: json.containsKey('scopeExtensions')
        ? (json['scopeExtensions'] as List)
            .map((e) => ScopeExtension.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    screenshots: json.containsKey('screenshots')
        ? (json['screenshots'] as List)
            .map((e) => Screenshot.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    shareTarget: json.containsKey('shareTarget')
        ? ShareTarget.fromJson(json['shareTarget'] as Map<String, dynamic>)
        : null,
    shortName:
        json.containsKey('shortName') ? json['shortName'] as String : null,
    shortcuts: json.containsKey('shortcuts')
        ? (json['shortcuts'] as List)
            .map((e) => Shortcut.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
    startUrl:
        json.containsKey('startUrl') ? json['startUrl'] as String : null,
    themeColor:
        json.containsKey('themeColor') ? json['themeColor'] as String : null,
  );
}