loadSound method

Sound loadSound(
  1. String path, {
  2. int retriggerDelayInMs = 0,
})

Loads a Sound from the audio file at the given path.

  • path: The path to the audio file.
  • retriggerDelayInMs: The minimum delay in milliseconds before this sound can be played again. Defaults to 0 (no delay).

Returns the Sound object, which will asynchronously load the audio data.

Implementation

Sound loadSound(String path, {int retriggerDelayInMs = 0}) {
  var sound =
      Sound()
        ..retriggerDelay = Duration(milliseconds: retriggerDelayInMs)
        ..loadFromFile(path, _loadingInfo, _audio.audioContext);

  return sound;
}