didUpdateController method

bool didUpdateController({
  1. StateXController? oldCon,
  2. StateXController? newCon,
})
inherited

Update the 'first' controller if necessary Place in the didUpdateWidget function in the special case the StatefulWidget supplies the controller: e.g. didUpdateController(oldWidget.controller, widget.controller);

Implementation

bool didUpdateController({
  StateXController? oldCon,
  StateXController? newCon,
}) {
  bool update = oldCon != null && newCon != null && _controller != null;
  // Test if supplied the parameters and there's a 'first' controller, _controller
  if (update) {
    // Don't bother if it's the same controller instance.
    update = _controller!.identifier != oldCon.identifier;

    if (update) {
      _controller = newCon;
    }
  }
  return update;
}