ProjectSettings.fromJson constructor
ProjectSettings.fromJson(
- Map<String, dynamic> json
)
Implementation
factory ProjectSettings.fromJson(Map<String, dynamic> json) {
final runtimeRaw = json['runtime'];
final runtime = runtimeRaw is Map<String, dynamic>
? ProjectRuntimeInfo.fromJson(runtimeRaw)
: (runtimeRaw is Map
? ProjectRuntimeInfo.fromJson(
runtimeRaw.map((key, value) => MapEntry('$key', value)),
)
: '${runtimeRaw ?? ''}');
final extras = Map<String, dynamic>.from(json)
..remove('name')
..remove('runtime')
..remove('main')
..remove('description')
..remove('author')
..remove('website')
..remove('license')
..remove('config')
..remove('template')
..remove('backend');
return ProjectSettings(
name: '${json['name'] ?? ''}',
runtime: runtime,
main: json['main'] == null ? null : '${json['main']}',
description: json['description'] == null
? null
: '${json['description']}',
author: json['author'] == null ? null : '${json['author']}',
website: json['website'] == null ? null : '${json['website']}',
license: json['license'] == null ? null : '${json['license']}',
config: json['config'] == null ? null : '${json['config']}',
template: json['template'] is Map
? ProjectTemplate.fromJson(
(json['template'] as Map).map(
(key, value) => MapEntry('$key', value),
),
)
: null,
backend: json['backend'] is Map
? ProjectBackend.fromJson(
(json['backend'] as Map).map(
(key, value) => MapEntry('$key', value),
),
)
: null,
extras: extras,
);
}