update<U> method

U update<U>(
  1. U oldValue,
  2. U newValue, {
  3. bool compare(
    1. U a,
    2. U b
    )?,
  4. bool? ignoreChange = false,
})
inherited

Call within the updateState method to determine the rebuild of the widget according to the state change.

Implementation

U update<U>(
  U oldValue,
  U newValue, {
  bool Function(U a, U b)? compare,
  bool? ignoreChange = false,
}) {
  if (oldValue == null) {
    _changed = true;
  } else if (ignoreChange == false && _changed == false) {
    _changed = compare == null
        ? oldValue != newValue
        : compare(oldValue, newValue) == false;
  }

  return newValue;
}