Pool<T> class

Constructors

Pool.new(int targetSize, FutureOr<T> _createItem(), {Future<void> onRemoveItem(T)?, FutureOr<bool> checkIsLive(T)?, Duration checkIsLiveTimeout = const Duration(seconds: 10), Duration? maxLifetime, void onChange()?})

Properties

available int
no setter
checkIsLiveTimeout Duration
final
hashCode int
The hash code for this object.
no setterinherited
maxLifetime Duration?
final
onChange → void Function()?
final
onRemoveItem Future<void> Function(T)?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
targetSize int
getter/setter pair
total int
no setter

Methods

fill() Future<void>
give(T item) → void
giveReserved(T item) → T
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(T item) → void
take({Duration? timeout = const Duration(seconds: 30)}) Future<T>
Takes an item from the pool.
toString() String
A string representation of this object.
inherited
use<R>(FutureOr<R> delegate(T), {Duration? timeout}) Future<R>
Takes an item from the pool and provides it to the delegate.

Operators

operator ==(Object other) bool
The equality operator.
inherited