getVolume method

Future<VolumeState> getVolume()

Retrieves the current volume level.

Implementation

Future<VolumeState> getVolume() async {
  try {
    final result =
        await _methodChannel.invokeMapMethod<String, dynamic>('getVolume');
    if (result == null) {
      throw Exception("Failed to retrieve volume state.");
    }
    return VolumeState.fromMap(result);
  } catch (e) {
    throw Exception("Error fetching volume state: $e");
  }
}