BatchFlushUtils<T extends Object> class

Collects items and flushes when batchSize reached or flush called.

Constructors

BatchFlushUtils(int batchSize, void onFlush(List<T> batch))
Creates a batcher that flushes via onFlush once batchSize items accumulate (or when flush is called explicitly). Audited: 2026-06-12 11:26 EDT

Properties

batchSize → int
Size at which the buffer is automatically flushed.
final
hashCode → int
The hash code for this object.
no setterinherited
length → int
Current number of items in the buffer. Audited: 2026-06-12 11:26 EDT
no setter
onFlush → void Function(List<T> batch)
Callback invoked with the buffered batch when a flush occurs. Audited: 2026-06-12 11:26 EDT
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(T item) → void
Appends item; flushes when buffer length reaches the batch size. Audited: 2026-06-12 11:26 EDT
flush() → void
Invokes onFlush with current buffer contents and clears the buffer. Audited: 2026-06-12 11:26 EDT
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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