setShuffleMode method

Future<bool> setShuffleMode (
  1. Shuffle mode
)

Set the shuffle mode.

Implementation

Future<bool> setShuffleMode(Shuffle mode) async {
  if (Platform.isIOS) {
    String mymode = "";
    switch (mode.index) {
      case 0:
        mymode = "off";
        break;
      case 1:
        mymode = "songs";
        break;
      case 2:
        mymode = "albums";
        break;
      default:
        throw "Incorrent mode!";
    }
    bool result = await playerChannel
        .invokeMethod('setShuffleMode', <String, dynamic>{"mode": mymode});
    return result;
  } else {
    throw PlatformException(
        code: "Device is not iOS!",
        message:
            "Currently only iOS is supported. Feel free to contribute to Playify to help support Android.");
  }
}