anchor.diff:  
     @override
     void visitClassDeclaration(ClassDeclaration node) {
  -    foundProviderUsage.add(false);
  -    methodDecls.clear();
  -    final name = node.extendsClause?.superclass.name.name;
  -    if (name == 'StatelessWidget') {
  -      withinClass = ClassType.stateless;
  -    } else if (name == 'State') {
  -      withinClass = ClassType.stateful;
  -    } else if (name == 'ConsumerWidget') {
  -      withinClass = ClassType.consumer;
  -      foundProviderUsage.last = true;
  -    } else if (name == 'HookWidget') {
  -      withinClass = ClassType.hook;
  -    } else {
  +    try {
  +      foundProviderUsage.add(false);
  +      methodDecls.clear();
  +      final name = node.extendsClause?.superclass.name.name;
  +      if (name == 'StatelessWidget') {
  +        withinClass = ClassType.stateless;
  +      } else if (name == 'State') {
  +        withinClass = ClassType.stateful;
  +      } else if (name == 'ConsumerWidget') {
  +        withinClass = ClassType.consumer;
  +        foundProviderUsage.last = true;
  +      } else if (name == 'HookWidget') {
  +        withinClass = ClassType.hook;
  +      } else {
  +        withinClass = ClassType.none;
  +      }
  +      if (name == 'StatefulWidget') {
  +        statefulDeclarations[node.name.name] = node;
  +        if (statefulNeedsMigration.contains(node.name.name)) {
  +          migrateStateful(node.name.name);
  +        }
  +      }
  +    } catch (e, st) {
  +      addError('visiting class declaration ${node.toSource()}\n$e\n$st');
  +    }
  +
  +    super.visitClassDeclaration(node);
  +
  +    try {
  +      if (foundProviderUsage.last) {
  +        migrateClass(node);
  +        migrateParams(buildParams);
  +      }
         withinClass = ClassType.none;
  -    }
  -    if (name == 'StatefulWidget') {
  -      statefulDeclarations[node.name.name] = node;
  -      if (statefulNeedsMigration.contains(node.name.name)) {
  -        migrateStateful(node.name.name);
  -      }
  -    }
  -    super.visitClassDeclaration(node);
  -    if (foundProviderUsage.last) {
  -      migrateClass(node);
  -      migrateParams(buildParams);
  -    }
  -    withinClass = ClassType.none;
  -    foundProviderUsage.removeLast();
  +      foundProviderUsage.removeLast();
  +    } catch (e, st) {
  +      addError('after visiting class declaration ${node.toSource()}\n$e\n$st');
  +    }
     }
   
     void migrateParams(FormalParameterList? buildParams) {
  
positive.code:       addError('visiting InstanceCreationExpression $type\n$e\n$st');
      }
      super.visitInstanceCreationExpression(node);
      inProvider = ProviderType.none;
      if (inConsumerBuilder || inHookBuilder) {
        foundProviderUsage.removeLast();
      }
      inConsumerBuilder = false;
      inHookBuilder = false;
      inAutoDisposeProvider = false;
    }
  
    @override
    void visitInvocationExpression(InvocationExpression node) {
      final type = node.staticType!.getDisplayString(withNullability: true);
  
      try {
        updateProviderType(type, node.staticType!);
  
        // Add type parameters if not already there
        if (type.contains('Provider') &&
  
negative.code: 
    @override
    void visitFunctionExpression(FunctionExpression node) {
      try {
        if ((inConsumerBuilder || inHookBuilder) && lookingForBuilderParams) {
          lookingForBuilderParams = false;
          migrateParams(node.parameters);
        }
      } catch (e, st) {
        addError('before visiting function expression $node\n$e\n$st');
      }
      super.visitFunctionExpression(node);
    }
  