'Flutter : Unhandled Exception: Unsupported operation: Functionality only available on Android

I am Using path_provider package , with audioplayers package , I want to access getExternalStorage through the ios version, I will put my own code but this code is only available for the android version.

  _initial() async {
Directory? appDir = await getExternalStorageDirectory();
String jrecord = 'Audiorecords';

String dato = "${DateTime.now().millisecondsSinceEpoch.toString()}.wav";
Directory appDirec = Directory("${appDir!.path}/$jrecord/");
if (await appDirec.exists()) {
  filePath = "${appDirec.path}$dato";
  audioRecorder =
      FlutterAudioRecorder(filePath, audioFormat: AudioFormat.WAV);
  await audioRecorder!.initialized;
} else {
  appDirec.create(recursive: true);
  showToast(
      message: 'Start Recording , Press Start',
      stateType: StateType.warning);
  filePath = "${appDirec.path}$dato";
  audioRecorder =
      FlutterAudioRecorder(filePath, audioFormat: AudioFormat.WAV);
  await audioRecorder!.initialized;
}

}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source