supplier property

Supplier<T> supplier
final

The supplier function that provides the initial value for each thread.

This function is called when the thread-local variable is first accessed in a thread to provide the initial value.

Example:

// Supplier that creates a new UUID for each thread
final threadId = SuppliedNamedThreadLocal<String>(
  'threadId',
  () => Uuid().v4(), // Different initial value for each thread
);

// Supplier that returns a new instance for each thread
final threadLocalService = SuppliedNamedThreadLocal<MyService>(
  'threadService',
  () => MyService(), // New instance for each thread
);

Implementation

final Supplier<T> supplier;