setIfChanged method

void setIfChanged(
  1. T value
)

Set $ to value, but only if they're different

Implementation

void setIfChanged(T value) {
  if (value == $) return;
  $ = value;
}