create static method
Pubspec
create({
- bool schemeUtilsIsSetDefaultData = false,
- String special_type = "pubspec",
- String? name,
- String? description,
- String? version,
- String? homepage,
- String? repository,
- String? issue_tracker,
- String? documentation,
- List<
String> ? funding, - List<
String> ? topics, - Environment? environment,
- Dependencies? dependencies,
- DevDependencies? dev_dependencies,
- DependencyOverrides? dependency_overrides,
- Platforms? platforms,
override
return original data json
Implementation
static Pubspec create({
bool schemeUtilsIsSetDefaultData = false,
String special_type = "pubspec",
String? name,
String? description,
String? version,
String? homepage,
String? repository,
String? issue_tracker,
String? documentation,
List<String>? funding,
List<String>? topics,
Environment? environment,
Dependencies? dependencies,
DevDependencies? dev_dependencies,
DependencyOverrides? dependency_overrides,
Platforms? platforms,
}) {
// Pubspec pubspec = Pubspec({
final Map pubspec_data_create_json = {
"@type": special_type,
"name": name,
"description": description,
"version": version,
"homepage": homepage,
"repository": repository,
"issue_tracker": issue_tracker,
"documentation": documentation,
"funding": funding,
"topics": topics,
"environment": (environment != null) ? environment.toJson() : null,
"dependencies": (dependencies != null) ? dependencies.toJson() : null,
"dev_dependencies":
(dev_dependencies != null) ? dev_dependencies.toJson() : null,
"dependency_overrides":
(dependency_overrides != null) ? dependency_overrides.toJson() : null,
"platforms": (platforms != null) ? platforms.toJson() : null,
};
pubspec_data_create_json.removeWhere((key, value) => value == null);
if (schemeUtilsIsSetDefaultData) {
defaultData.forEach((key, value) {
if (pubspec_data_create_json.containsKey(key) == false) {
pubspec_data_create_json[key] = value;
}
});
}
return Pubspec(pubspec_data_create_json);
}