asset_span_builder 1.0.1 copy "asset_span_builder: ^1.0.1" to clipboard
asset_span_builder: ^1.0.1 copied to clipboard

A script for building asset spans from input files.

asset_span_builder #

Description #

A simple script for generating asset spans from data files.

Using #

Store your assets in a folder which you don't include in your flutter assets map. For example:

sounds/
  music/
    main_theme.mp3
    level_1.mp3
  voices/
    hello.wav
    goodbye.wav
    start_playing.wav

Run asb for the first time. It will generate a spans.yaml file which you can edit.

Add the directories you want in the directories map of spans.yaml. The resulting file should look something like this:

dataDirectory: assets
directories:
  sounds/music: lib/src/music_sounds.dart
  sounds/voices: lib/src/voices_sounds.dart
dataFileExtension: .dat
supportedSoundFileExtensions:
  - .mp3
  - .wav

Run asb again. It should generate the above Dart files.

Now you can use the resulting spans like so:

import 'src/music_sounds.dart';
final mainTheme = MusicSounds.mainTheme.asSound(destroy: false, looping: true);

Including different files #

I made this package to bundle up sound files. If you have a different use case, simply edit the supportedFileExtensions list like so:

supportedFileExtensions:
  - .level
  - .jpg
0
likes
150
points
187
downloads

Publisher

verified publisherbackstreets.site

Weekly Downloads

A script for building asset spans from input files.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MPL-2.0 (license)

Dependencies

filesize, json_annotation, path, recase, yaml, yaml_edit

More

Packages that depend on asset_span_builder