assetx 0.0.2 copy "assetx: ^0.0.2" to clipboard
assetx: ^0.0.2 copied to clipboard

discontinued

Type-safe asset mapping for Flutter. Generates nested Dart code for easy asset access.

AssetX - Type-Safe Asset Mapping for Flutter #

Generate nested, type-safe asset access for Flutter. No more hardcoded paths.

Usage #

// Instead of this:
Image.asset('assets/images/profile/user_avatar.png')

// Use this:
AssetMap.assets.images.profile.user_avatar.asset

Setup #

  1. Add to pubspec.yaml:
dev_dependencies:
  assetx: ^1.0.0
  1. Create assetx.yaml:
destination: lib/generated_assets.dart
sources_include:
  - path: assets/
    recursive: true
type_registry:
  image:
    file_extensions: [png, jpg, gif]
  data:
    file_extensions: [json, yaml]
map_registry:
  image:
    builtin: imagex
  data:
    builtin: datax
  1. Run: dart run assetx

Features #

  • Type-safe: AssetMap.folder.subfolder.file.asset
  • Unified asset tree: Single organized structure for all your assets
  • Auto pubspec updates: Automatically adds assets to pubspec.yaml
  • Less fragmented code: One import, access everything
  • Dual mode: Production (packages/...) and local (assets/...) paths
  • Custom types: Define your own asset handlers
  • Pattern matching: Include/exclude by file patterns

Configuration Options #

# Basic
destination: lib/generated_assets.dart
sources_include:
  - path: assets/
    recursive: true

# Exclude paths/patterns  
sources_exclude:
  - path: assets/temp/
patterns_exclude: ["*.tmp"]

# Custom types
type_registry:
  custom:
    pattern: ["*/config.json"]
map_registry:
  custom:
    src: "lib/models.dart::Config"

Summary #

AssetX creates a unified asset tree with automatic pubspec management. One configuration, one import, access all your assets through a clean nested structure.

0
likes
0
points
87
downloads

Publisher

unverified uploader

Weekly Downloads

Type-safe asset mapping for Flutter. Generates nested Dart code for easy asset access.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, json_annotation, path, yaml

More

Packages that depend on assetx