result method

StubbleResult result(
  1. StubbleContext context
)

Implementation

StubbleResult result(StubbleContext context) {
  var res = '';

  if (_res == true) {
    try {
      final fn = context.compile(_body);

      if (fn != null) {
        res = fn(context.data);
      }
    } catch (e) {
      return StubbleResult(
        err: StubbleError(
          code: errorIfBlockMalformed,
          text: 'If block error: $e',
        ),
      );
    }
  }

  return StubbleResult(pop: true, result: res);
}