setBalance method

Future<void> setBalance(
  1. double balance
)

Sets the balance of the audio player.

balance: The desired balance level, where -1.0 is full left, 0.0 is center, and 1.0 is full right.

Implementation

Future<void> setBalance(double balance) async {
  try {
    // Invoke the native method to set the balance
    await _channel.invokeMethod('setBalance', {'balance': balance});
  } catch (e) {
    // Log any errors that occur while setting the balance
    log("Error setting balance: ${e.toString()}");
  }
}