replace method

T replace(
  1. T val
)

Replaces the inner value with the provided val and returns the original inner value.

Implementation

@pragma("vm:prefer-inline")
T replace(T val) {
  final temp = _val;
  _val = val;
  return temp;
}