remove method

void remove()

Removes the value associated with this LocalThread in the current Isolate.

After removal, get() will return null until a new value is set.

Example

final local = ThreadLocal<String>();
local.set('temp');
print(local.get()); // temp

local.remove();
print(local.get()); // null

Implementation

void remove() {
  final bucket = isolateLocalValueStore.getBucket<T>(Isolate.current, _key);
  bucket.remove();
}