setVolume method Null safety

Future<int> setVolume(
  1. double volume,
  2. AudioDeviceType audioDeviceType
)

This function sets the volume of the specified audio device type. The volume level is a number between 0 and 1, with 1 being the maximum volume.

Implementation

static Future<int> setVolume(double volume, AudioDeviceType audioDeviceType) async {
  if (volume > 1) volume = (volume / 100).toDouble();
  final Map<String, dynamic> arguments = {'deviceType': audioDeviceType.index, 'volumeLevel': volume};
  final result = await audioMethodChannel.invokeMethod<int>('setAudioVolume', arguments);
  return result as int;
}