applyOnBatch static method

dynamic Function() applyOnBatch(
  1. dynamic next(),
  2. LevitReactiveBatch change
)

Applies the onBatch chain to a batch operation.

Implementation

static dynamic Function() applyOnBatch(
  dynamic Function() next,
  LevitReactiveBatch change,
) {
  if (!LevitReactiveMiddleware.hasBatchMiddlewares) return next;
  var current = next;
  for (final mw in LevitReactiveMiddleware._middlewares.reversed) {
    if (mw.onBatch != null) {
      current = mw.onBatch!(current, change);
    }
  }
  return current;
}