PubSpec.fromJson constructor
PubSpec.fromJson(
- Map? json
Implementation
factory PubSpec.fromJson(Map? json) {
final p = parseJson(json, consumeMap: true);
return PubSpec(
name: p.single('name'),
author: p.single('author'),
version: p.single('version', (v) => Version.parse(v)),
homepage: p.single('homepage'),
documentation: p.single('documentation'),
description: p.single('description'),
publishTo: p.single('publish_to', (v) => Uri.parse(v)),
environment: p.single('environment', (v) => Environment.fromJson(v)),
dependencies:
p.mapValues('dependencies', (v) => DependencyReference.fromJson(v)),
devDependencies: p.mapValues(
'dev_dependencies', (v) => DependencyReference.fromJson(v)),
dependencyOverrides: p.mapValues(
'dependency_overrides', (v) => DependencyReference.fromJson(v)),
executables: p.mapValues('executables', (v) => Executable.fromJson(v)),
unParsedYaml: p.unconsumed);
}