build method

  1. @override
String build(
  1. Context context,
  2. ParserResult? result
)
override

Implementation

@override
String build(Context context, ParserResult? result) {
  if (n < 1) {
    throw RangeError.value(n, 'n', 'Must be greater than 0');
  }

  final fast = result == null;
  final values = context.allocateLocals(['count', 'list', 'pos']);
  final r1 = context.getResult(parser, !fast);
  values.addAll({
    'n': '$n',
    'O': '$O',
    'p1': parser.build(context, r1),
  });
  final String template;
  if (fast) {
    template = _templateFast;
  } else {
    template = _template;
  }

  return render(template, values, [result, r1]);
}