Future<Sound> loadDataUrl(String dataUrl, [ SoundLoadOptions soundLoadOptions ])

Loads a sound from a data url.

Please be aware that browsers do support different kinds of audio types. You can get a list of supported types here: Sound.supportedTypes

var sound = await Sound.loadDataUrl("data:audio/mpeg;base64,<data>");
sound.play();

Source

static Future<Sound> loadDataUrl(
    String dataUrl, [SoundLoadOptions soundLoadOptions]) async {

  try {
    var audioUrls = <String>[dataUrl];
    var audioLoader = new AudioLoader(audioUrls, false, false);
    var audioElement = await audioLoader.done;
    return new AudioElementSound._(audioElement);
  } catch (e) {
    var options = soundLoadOptions ?? Sound.defaultLoadOptions;
    if (options.ignoreErrors) {
      return MockSound.loadDataUrl(dataUrl, options);
    } else {
      rethrow;
    }
  }
}