toMap method

Map<String, dynamic> toMap({
  1. bool addComments = false,
})

Implementation

Map<String, dynamic> toMap({bool addComments = false}) {
  return {
    if (name != null) 'name': name,
    if (description != null) 'description': description,
    if (version != null) 'version': version,
    if (homepage != null) 'homepage': homepage,
    if (repository != null) 'repository': repository,
    if (issueTracker != null) 'issue_tracker': issueTracker,
    if (documentation != null) 'documentation': documentation,
    if (publishTo != null) 'publish_to': publishTo,
    if (environment != null) 'environment': environment?.toMap(),
    if (dependencies != null)
      'dependencies': dependencies?.toMap(addComments: addComments),
    if (devDependencies != null)
      'dev_dependencies': devDependencies?.toMap(addComments: addComments),
    if (dependenciesOverride != null)
      'dependency_overrides':
          dependenciesOverride?.toMap(addComments: addComments),
    if (flutter != null) 'flutter': flutter?.toMap(),
    if (others != null) ...others!
  };
}