notify method

StubbleResult notify(
  1. NotifyMessage msg,
  2. StubbleContext context
)

Implementation

StubbleResult notify(NotifyMessage msg, StubbleContext context) {
  switch (msg.type) {
    case notifyPathResult:
      _path = msg.value;

      return StubbleResult(
        message: ProcessMessage(
          charCode: msg.charCode!,
        ),
      );

    case notifySecondCloseBracketFound:
      return StubbleResult(
        state: GetBlockEndState(
          blockName: 'each',
        ),
      );

    case notifyBlockEndResult:
      _body = msg.value;
      return result(context);

    default:
      return StubbleResult(
        err: StubbleError(
          code: errorUnsupportedNotify,
          text:
              'State "$runtimeType" does not support notifies of type ${msg.type}',
        ),
      );
  }
}