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).
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.
no setter
-
onFlush
→ void Function(List<T> batch)
-
Callback invoked with the buffered batch when a flush occurs.
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.
-
flush()
→ void
-
Invokes onFlush with current buffer contents and clears the buffer.
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
toString()
→ String
-
A string representation of this object.
override