move method

  1. @override
Future<void> move(
  1. int from,
  2. int to, {
  3. bool synchronized = true,
})
override

Moves the playlist Media at from, so that it takes the place of the Media to.

Implementation

@override
Future<void> move(int from, int to, {bool synchronized = true}) {
  Future<void> function() async {
    if (disposed) {
      throw AssertionError('[Player] has been disposed');
    }
    await waitForPlayerInitialization;
    await waitForVideoControllerInitializationIfAttached;

    final command = 'playlist-move $from $to'.toNativeUtf8();
    mpv.mpv_command_string(
      ctx,
      command.cast(),
    );
    calloc.free(command.cast());
  }

  if (synchronized) {
    return lock.synchronized(function);
  } else {
    return function();
  }
}