check method

  1. @override
void check(
  1. DcqRegistry registry
)

Implementation

@override
void check(DcqRegistry registry) {
  registry.addClassDeclaration((node) {
    final superclass = node.extendsClause?.superclass.type;
    if (superclass is! InterfaceType || !isBloc(superclass)) return;

    final body = node.body;
    if (body is! BlockClassBody) return;

    // Look for on<EventType> calls in constructors.
    final handledEvents = <String>{};
    for (final member in body.members) {
      if (member is! ConstructorDeclaration) continue;
      member.accept(_HandlerVisitor(this, handledEvents));
    }
  });
}