Downloader#
flet_pkg.core.downloader
#
Pub.dev package downloader.
Downloads Flutter package source tarballs from pub.dev with local caching to avoid repeated downloads.
PackageNotFoundError
#
Bases: Exception
Raised when a package is not found on pub.dev.
DownloadError
#
Bases: Exception
Raised when a download fails.
PackageMetadata
dataclass
#
PackageMetadata(name: str, version: str, description: str = '', homepage: str = '', repository: str = '')
Metadata for a pub.dev package.
PubDevDownloader
#
Downloads and caches Flutter packages from pub.dev.
Packages are cached in ~/.cache/flet-pkg/{name}-{version}/
so repeated runs are instantaneous.
Source code in src/flet_pkg/core/downloader.py
fetch_metadata
#
Fetch package metadata from pub.dev.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_name
|
str
|
The pub.dev package name. |
required |
Returns:
| Type | Description |
|---|---|
PackageMetadata
|
PackageMetadata with name, version, description, etc. |
Raises:
| Type | Description |
|---|---|
PackageNotFoundError
|
If the package doesn't exist. |
DownloadError
|
On network errors. |
Source code in src/flet_pkg/core/downloader.py
download
#
Download a Flutter package source tarball from pub.dev.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_name
|
str
|
The pub.dev package name. |
required |
version
|
str | None
|
Specific version to download. If None, uses latest. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the extracted package directory. |
Raises:
| Type | Description |
|---|---|
PackageNotFoundError
|
If the package doesn't exist. |
DownloadError
|
On network/extraction errors. |