Sign in Get 3 free credits

Try a job or a niche: tiktok captions, study notes, excel formulas. Press Esc to close.

Flutter Sound Loading

Loads sounds and music in Flutter with flutter_soloud so effects play instantly and memory is freed properly.

Claude's review

7/10 Accurate loading and lifecycle guide for flutter_soloud with useful preload and dispose advice; closer to docs than the streaming skills.

We asked Claude the question you would ask: would I be glad I installed this? We only sell skills it rates 7 or higher.

In detail

Teaches how to load audio into flutter_soloud via loadAsset/loadMem/loadFile/loadUrl and joinTwoSources, choose between LoadMode.memory and LoadMode.disk, and manage the AudioSource lifecycle (disposeSource, autoDispose, allInstancesFinished). Use when a user asks to load or play an audio file, asset, URL, or byte buffer, to preload game sound effects (gunshots, footsteps, UI clicks) or background music, to fix load errors, "no sound" bugs or sounds that start late because they are loaded when played, to handle web platform constraints, or to clean up/dispose loaded sounds.

How you use it

  1. Add it to your pack, then download your pack (1 credit).
  2. In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
  3. Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide

Safety check

Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.

An automated scan lowers risk but cannot promise zero risk. How we check skills

Preview

The first lines of SKILL.md
---
name: flutter-soloud-loading
version: 4
description: Teaches how to load audio into flutter_soloud via loadAsset/loadMem/loadFile/loadUrl and joinTwoSources, choose between LoadMode.memory and LoadMode.disk, and manage the AudioSource lifecycle (disposeSource, autoDispose, allInstancesFinished). Use when a user asks to load or play an audio file, asset, URL, or byte buffer, to preload game sound effects (gunshots, footsteps, UI clicks) or background music, to fix load errors, "no sound" bugs or sounds that start late because they are loaded when played, to handle web platform constraints, or to clean up/dispose loaded sounds.
---

Loading in flutter_soloud is a two-step model, unlike audioplayers/just_audio: you first *load* bytes into the SoLoud C++ engine and get an `AudioSource` handle, then `play()` it any number of times, and finally *dispose* it yourself. There is no `setUrl`/`AudioPlayer` object that owns a resource for you — the `AudioSource` is just a hash (`soundHash`) referencing native memory until you dispose it.

## Minimal example

```dart
import 'package:flutter_soloud/flutter_soloud.dart';

Future<void> main() async {
  await SoLoud.instance.init();

  final source = await SoLoud.instance.loadAsset(
    'assets/sound.mp3',
    autoDispose: true, // disposed automatically when playback finishes
  );

  final handle = SoLoud.instance.play(source);
  // One source, many concurrent instances:
  final handle2 = SoLoud.instance.play(source);

  // Without autoDispose, dispose manually when the sound is no longer needed
  // (this also stops its playing handles):
  // await SoLoud.instance.disposeSource(source);
}
```

## The API shape

All loaders are on `SoLoud.instance` and require `await SoLoud.instance.init()` first (otherwise every loader throws `SoLoudNotInitializedException`).

- `Future<AudioSource> loadAsset(String key, {LoadMode mode = LoadMode.memory, AssetBundle? assetBundle, bool autoDispose = false})` — `key` is an asset key like `'assets/sound.mp3'` (NOT a file path). On native, the asset is copied to a temp file and loaded from there. On Web it reads the bundle bytes and delegates to `loadMem`, so it works everywhere.
- `Future<AudioSource> loadMem(String path, Uint8List buffer, {LoadMode mode = LoadMode.memory, bool autoDispose = false})` — `buffer` is the bytes of a *supported audio file* (any format listed below), not raw PCM. `path` is only a reference name to distinguish this buffer (e.g. `'my_sound.mp3'`), not a real filesystem path. The only loader usable on Web (and the one `loadAsset`/`loadUrl` delegate to there); on Web `mode` is ignored and data is fed to the engine in chunks, yielding to the event loop to keep the UI responsive. Bytes that cannot be decoded throw `SoLoudFileLoadFailedException` on every platform.
- `Future<AudioSource> loadFile(String path, {LoadMode mode = LoadMode.memory, bool autoDispose = false})` — absolute filesystem path. NOT available on Web: it throws `UnimplementedError` there (use `loadMem` instead).
- `Future<AudioSource> loadUrl(String url, {LoadMode mode = LoadMode.memory, http.Client? httpClient, bool autoDispose = false})` — downloads the file, then loads it (temp file on native, `loadMem` on Web). Non-`200` status throws `SoLoudNetworkStatusCodeException`. Pass your own `http.Client` when loading many URLs at startup — otherwise a new client is created per call. On Web the request is subject to normal CORS rules.
- `Future<AudioSource> joinTwoSources(String path, Uint8List bufferLeft, Uint8List bufferRight, {bool autoDispose = false})` — builds one stereo `AudioSource` from two buffers (bytes of supported audio files). Non-mono input is converted to mono on the native side; both sides are resampled to the engine sample rate; if lengths differ, the shorter side is padded with silence to match the longer. Always loads fully into RAM (`LoadMode.memory`), no `mode` parameter.
...

From alnitak's repository, MIT licence.

Related skills

  • Checked

    Android Gradle Plugin upgrade

    Moves Kotlin Multiplatform projects to Android Gradle Plugin 9 and fixes the build failures it causes.

    by Kotlin 1.1k
    8/101 credit
  • Checked

    CocoaPods to SwiftPM

    Moves Kotlin Multiplatform projects from CocoaPods to Swift Package Manager and updates the Xcode project.

    by Kotlin 1.1k
    8/101 credit
  • Checked

    Kotlin Native build speed

    Diagnoses and fixes slow Kotlin/Native iOS builds in Kotlin Multiplatform projects, both locally and on CI.

    by Kotlin 1.1k
    8/101 credit
  • Checked

    SwiftUI Liquid Glass

    Adds and reviews Liquid Glass in SwiftUI apps for iOS 26, avoiding pitfalls with bars, buttons and scrolling.

    by FloWritesCode 476
    8/101 credit
  • Checked

    Compose Multiplatform UI

    Builds one shared Compose UI in Kotlin for Android, iOS and desktop, so you write your screens once.

    by ericrisco 691
    7/101 credit
  • Checked

    SwiftUI Mac app rules

    Writes and debugs Swift 6 and SwiftUI code for Mac apps, fixing concurrency, state and common compiler errors.

    by daveebbelaar 2k
    7/101 credit

Secure checkout

Credits

AUD

  1. 1Choose
  2. 2Pay on Square
  3. 3Credits added