call method

  1. @override
T call([
  1. T? v
])
override

Updates and retrieves the value using call syntax.

If called with an argument, it updates the value. If called without arguments, it returns the current value.

// Example usage:

count(5); // Update
print(count()); // Read

Implementation

@override
T call([T? v]) {
  if (v is T) {
    value = v;
  }
  return value;
}