preloadEffect method Null safety

Future<void> preloadEffect(
  1. int soundId,
  2. String filePath

Preloads a specified audio effect file into the memory.

Supported audio formats: mp3, aac, m4a, 3gp, wav.


  • This method does not support online audio effect files.
  • To ensure smooth communication, limit the size of the audio effect file. We recommend using this method to preload the audio effect before calling the RtcEngine.joinChannel method.

Parameter soundId ID of the audio effect. Each audio effect has a unique ID.

Parameter filePath The file path, including the filename extensions.

  • Android: Agora supports using a URI address, an absolute path, or a path that starts with /assets/. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav. For details, see Supported Media Formats. Note: You might encounter permission issues if you use an absolute path to access a local file, so Agora recommends using a URI address instead. For example: "content://".
  • iOS: Agora supports using an absolute path. For example: /var/mobile/Containers/Data/audio.mp4. Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. For details, see Best Practices for iOS Audio.


Future<void> preloadEffect(int soundId, String filePath) {
  return _invokeMethod('preloadEffect', {
    'soundId': soundId,
    'filePath': filePath,