didUpdateWidget method

  1. @override
void didUpdateWidget(
  1. covariant AliPlayerWidget oldWidget
)
override

状态更新回调 当 Widget 的状态被更新时,该方法被调用。

Called when the state of the widget is updated.

Implementation

@override
void didUpdateWidget(covariant AliPlayerWidget oldWidget) {
  super.didUpdateWidget(oldWidget);

  logi("[lifecycle] didUpdateWidget");

  // 如果控制器发生变化,则更新内部状态
  if (widget._controller != oldWidget._controller) {
    _playController = widget._controller;
    setState(() {});
  }
}