ReleasePackerDartBuild.fromJson constructor
Creates a dart build subcommand from a dart_build_<subcommand>
JSON value.
Implementation
factory ReleasePackerDartBuild.fromJson(String subcommand, Object? json) {
if (subcommand == 'cli') {
return ReleasePackerDartBuildCli.fromJson(json);
}
List<String> args;
if (json == null || json == true) {
args = <String>[];
} else if (json is String) {
args = ReleasePackerCommand.parseInlineCommand(json);
} else if (json is List) {
args = json.map((e) => '$e').toList();
} else {
throw ArgumentError("Invalid `dart_build_$subcommand` value: $json");
}
return ReleasePackerDartBuild(subcommand, args);
}