detach method Null safety

  1. @override
void detach(
  1. ScrollPosition position
)
override

Unregister the given position with this controller.

After this function returns, the animateTo and jumpTo methods on this controller will not manipulate the given position.

Implementation

@override
void detach(ScrollPosition position) {
  super.detach(position);
  assert(_positionToListener.containsKey(position));
  position.removeListener(_positionToListener[position]!);
  _positionToListener.remove(position);
  if (_lastUpdated == position) {
    _lastUpdated = null;
  }
  if (_positionToListener.isEmpty) {
    _lastUpdatedOffset = null;
  }
}