Add
π Description
The add command allows you to easily add new packages to your Flutter project's pubspec.yaml. It provides an interactive way to search, select, and install packages from pub.dev with proper dependency management.
βοΈ Usage
gexd add [package_name] [options]
gexd add [package_name] [version] [options]π Basic Examples:
# Add a package interactively
gexd add
# Add a specific package
gexd add http
# Add a package with specific version
gexd add http ^1.1.0
# Add multiple packages
gexd add http dio shared_preferences
# Add as dev dependency
gexd add --dev test mockito
# Preview changes without applying
gexd add http --dry-runπ© Flags
--dev
Add package as a dev dependency
--dry-run
Show what would be added without making changes
--git-url <url>
Add package from git repository
--git-ref <ref>
Specify git branch/tag/commit
--path <path>
Add package from local path
--hosted-url <url>
Add package from custom pub server
π― Interactive Mode
When run without package name, add enters interactive mode:
π Search packages on pub.dev
π Browse results with descriptions and ratings
β Select packages to add
βοΈ Choose dependency type (regular/dev)
π¦ Install automatically
π Examples by Use Case:
Web Packages:
gexd add dio http url_launcherState Management:
gexd add get riverpod blocUI Components:
gexd add flutter_svg cached_network_imageDevelopment Tools:
gexd add --dev test flutter_test mockitoGit Dependencies:
gexd add my_package --git-url https://github.com/user/repo.git
gexd add my_package --git-url https://github.com/user/repo.git --git-ref developβ
What It Does:
π¦ Package Search - Finds packages on pub.dev
π Version Resolution - Determines compatible versions
βοΈ pubspec.yaml Update - Adds dependency entries
β¬οΈ Package Installation - Runs
dart pub getπ§ Import Suggestions - Shows import statements
β οΈ Notes:
π Version Constraints: Uses compatible version ranges by default
β‘ Conflict Resolution: Automatically resolves version conflicts
π Project Validation: Ensures project is a valid Flutter/Dart project
π Dependency Analysis: Checks for existing dependencies
Generated automatically by gexd_doc
Last updated