check method
void
check(
- DcqRegistry registry
)
Implementation
@override
void check(
DcqRegistry registry,
) {
registry.addMethodInvocation((node) {
if (node.methodName.name != 'setState') return;
final arguments = node.argumentList.arguments;
if (arguments.length != 1) return;
final argument = arguments.first;
if (argument is! FunctionExpression) return;
final body = argument.body;
if (body is BlockFunctionBody && body.block.statements.isEmpty) {
reportAtNode(node);
} else if (body is ExpressionFunctionBody) {
final expression = body.expression;
if (expression is NullLiteral) {
reportAtNode(node);
}
}
});
}