run method

  1. @override
void run(
  1. CustomLintResolver resolver,
  2. ErrorReporter reporter,
  3. CustomLintContext context
)

Emits lints for a given file.

run will only be invoked with files respecting filesToAnalyze

Implementation

@override
void run(
  CustomLintResolver resolver,
  ErrorReporter reporter,
  CustomLintContext context,
) {
  context.registry.addInstanceCreationExpression((node) {
    final type = node.constructorName.type.type;
    if (type == null) return;

    final String typeName = type.toString();

    // Check for animation-related widgets
    if (_isAnimationWidget(typeName) && !_hasKeyParameter(node)) {
      reporter.atNode(node, code);
    }
  });
}