Packages from pub.dev
Packages from pub.dev
About
- Dependency Management: Centralized repository
- Versioning: Semantic versioning
- Quality Indicators: Likes, popularity, health
- Categories: Flutter, web, server
Main Topics
-
Finding Packages
- Definition: Search and discovery
- Example:
# Popular packages: # http, provider, bloc, get_it
-
Adding Dependencies
- Definition: pubspec.yaml
- Example:
dependencies: http: ^0.13.3 provider: ^6.0.1
-
Version Constraints
- Definition: Caret syntax
- Example:
dependencies: path: ^1.8.0 # 1.8.0 <= version < 2.0.0
-
Dev Dependencies
- Definition: Test/build only
- Example:
dev_dependencies: test: ^1.16.8 mockito: ^5.0.0
-
Updating Packages
- Definition: Version resolution
- Example:
flutter pub upgrade flutter pub outdated
How to Use
- Search: pub.dev website
- Add: Edit pubspec.yaml
- Install:
flutter pub get
- Update: Regularly check upgrades
How It Works
- Resolution: Version solving
- Download: Package caching
- Locking: pubspec.lock
- Integration: Build system
Example:
name: my_app
description: A sample application
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
http: ^0.13.3
dev_dependencies:
flutter_test:
sdk: flutter
Conclusion
Pub.dev packages provide a vast ecosystem of reusable Dart and Flutter code. By understanding version constraints, dependency types, and update practices, developers can effectively leverage community packages while maintaining stable application builds.