check method

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

Implementation

@override
void check(DcqRegistry registry) {
  registry.addConstructorDeclaration((node) {
    final classDecl = node.parent is ClassDeclaration
        ? node.parent! as ClassDeclaration
        : node.parent?.parent is ClassDeclaration
        ? node.parent!.parent! as ClassDeclaration
        : null;
    if (classDecl == null) return;
    final superclass = classDecl.extendsClause?.superclass.type;
    if (superclass is! InterfaceType || !isBloc(superclass)) return;

    for (final param in node.parameters.parameters) {
      final type = param.declaredFragment?.element.type;
      if (type is InterfaceType && isBloc(type)) {
        reportAtNode(param);
      }
    }
  });
}