onStateChanged method

void onStateChanged(
  1. void callback(
    1. PlaybackState oldValue,
    2. PlaybackState newValue
    )?, {
  2. bool reply = false,
})

Implementation

// reply: true to let native code wait for dart callback result
void onStateChanged(
    void Function(PlaybackState oldValue, PlaybackState newValue)? callback,
    {bool reply = false}) {
  if (callback == null) {
    _stateCb.clear();
    Libfvp.unregisterType(nativeHandle, 1);
  } else {
    _stateCb.add(callback);
    Libfvp.registerType(nativeHandle, 1, reply);
  }
}