withIterationContext static method

List withIterationContext(
  1. List iteratedFunction(
    1. IterationContext
    ),
  2. Map<String, dynamic> passed
)

Implementation

static List<dynamic> withIterationContext(
    List<dynamic> Function(IterationContext) iteratedFunction,
    Map<String, dynamic> passed) {
  final topIterationContext = passed[_iterationKey];
  final thisIterationContext = IterationContext();
  passed[_iterationKey] = thisIterationContext;

  final result = iteratedFunction(thisIterationContext);

  passed[_iterationKey] = topIterationContext;

  return result;
}