PubSpec class

A representation of the loaded or created pubspec.yaml. All operations start here.

Constructors

PubSpec({required String name, String? version, String? description, EnvironmentBuilder? environment})
Create an in memory pubspec.yaml.
PubSpec.load({String? directory, String filename = 'pubspec.yaml', bool search = true})
Loads the pubspec.yaml file from the given directory or the current work directory if directory is not passed.
factory
PubSpec.loadFromPath(String pathTo)
Allows you to load the pubspec from path which includes the directory and filename.
factory
PubSpec.loadFromString(String content)
Loads the content of a pubspec.yaml from content.
factory

Properties

dependencies Dependencies
List of dependencies for the package.
latefinal
dependencyOverrides Dependencies
During the development process, you might need to temporarily override a dependency. It is now recommended that you place overrides in a separate file pubpsec_overrides.yaml
latefinal
description Description
package description.
getter/setter pair
devDependencies Dependencies
List of the dev dependencies for the package.
latefinal
document Document
Document that holds the lines read from the pubspec.yaml
getter/setter pair
documentation Documentation
Url of the documentation for the package.
latefinal
environment Environment
The dart and/or flutter sdk version constraints.
getter/setter pair
executables Executables
List of the executables that will be added to the path when this package is globally activated ('dart pub global activate')
latefinal
hashCode int
The hash code for this object.
no setterinherited
homepage Homepage
url to the homepage of the package.
latefinal
issueTracker IssueTracker
Url of the issue tracker for the package.
latefinal
loadedFrom String
Returns the path that the pubspec was loaded from.
no setter
name Name
Name of the package.
getter/setter pair
platforms Platforms
List o fthe platforms supported by this package.
latefinal
publishTo PublishTo
the url of the repository where this package is to be published or 'none' if the package should never be published.
latefinal
repository Repository
Url of the source code repository for the package.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
version Version
version of the package.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
save({String? directory, String? filename}) → void
Save the pubspec.yaml to directory with the given filename.
saveTo(String pathTo) → void
Allows you to save the pubpsec to the file located at pathTo. pathTo must contains both the directory and file name. If only the filename is present then the pubspec is saved to the current working directory. @see you should normally use save.
toString() String
A string representation of this object.
override
write(Writer writer) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isRoot(String path) bool