anchor.diff:  
     @override
     void visitFunctionDeclaration(FunctionDeclaration node) {
  -    currentFunctionInfo = ProviderFunction(
  -        name: node.name.name,
  -        path: node.declaredElement!.declaration.location!.components.join('/'),
  -        line: node.name.offset);
  -    isProviderDependentFunction[currentFunctionInfo!] = false;
  -    functionDependencies[currentFunctionInfo!] = {};
  +    try {
  +      currentFunctionInfo = ProviderFunction(
  +          name: node.name.name,
  +          path:
  +              node.declaredElement!.declaration.location!.components.join('/'),
  +          line: node.name.offset);
  +      isProviderDependentFunction[currentFunctionInfo!] = false;
  +      functionDependencies[currentFunctionInfo!] = {};
  +    } catch (e) {
  +      // addError('visiting function declaration ${node.toSource()}\n$e\n$st');
  +    }
       super.visitFunctionDeclaration(node);
       currentFunctionInfo = null;
     }
   
     @override
     void visitMethodDeclaration(MethodDeclaration node) {
  -    currentFunctionInfo = ProviderFunction(
  -        name: node.name.name,
  -        path: node.declaredElement!.declaration.location!.components.join('/'),
  -        line: node.name.offset);
  -    isProviderDependentFunction[currentFunctionInfo!] = false;
  -    functionDependencies[currentFunctionInfo!] = {};
  +    try {
  +      currentFunctionInfo = ProviderFunction(
  +          name: node.name.name,
  +          path:
  +              node.declaredElement!.declaration.location!.components.join('/'),
  +          line: node.name.offset);
  +      isProviderDependentFunction[currentFunctionInfo!] = false;
  +      functionDependencies[currentFunctionInfo!] = {};
  +    } catch (e) {
  +      // addError('visiting method declaration ${node.toSource()}\n$e\n$st');
  +    }
       super.visitMethodDeclaration(node);
       currentFunctionInfo = null;
     }
  
positive.code: 
    @override
    void visitFunctionExpression(FunctionExpression node) {
      if ((inConsumerBuilder || inHookBuilder) && lookingForBuilderParams) {
        lookingForBuilderParams = false;
        migrateParams(node.parameters);
      }
      super.visitFunctionExpression(node);
    }
  
negative.code: 
    @override
    void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
      try {
        final functionName = node.function.toSource();
        if (withinClass == ClassType.none && !functionName.startsWith('use')) {
          if (functionName == 'watch' && withinScopedProvider) {
            yieldPatch('ref.watch', node.function.offset, node.function.end);
          }
          migrateStateProvider(node.argumentList.arguments.first);
  
          super.visitFunctionExpressionInvocation(node);
          return;
        }
        if (functionName == 'watch' || functionName == 'useProvider') {
          foundProviderUsage.last = true;
          migrateStateProvider(node.argumentList.arguments.first);
          // watch(provider) => watch(provider.notifier)
          // useProvider(provider) => useProvider(provider.notifier)
          yieldPatch('ref.watch', node.function.offset, node.function.end);
        } else if (functionName.startsWith('use')) {
          final func = ProviderFunction(
            name: node.staticElement!.name,
            path: node.staticElement!.declaration.location!.components.join('/'),
            line: node.staticElement!.declaration.nameOffset,
          );
          migrateStateProvider(node.argumentList.arguments.first);
  
          if (RiverpodProviderUsageInfo.shouldMigrate(func)) {
            migrateFunctionCall(node.argumentList);
            foundProviderUsage.last = true;
          }
        } else if (functionName == 'read') {
          foundProviderUsage.last = true;
          migrateStateProvider(node.argumentList.arguments.first);
  
          // watch(provider) => watch(provider.notifier)
          // useProvider(provider) => useProvider(provider.notifier)
          yieldPatch('ref.read', node.function.offset, node.function.end);
        }
      } catch (e, st) {
        addError('when visiting function expression invocation\n$e\n$st');
      }
      super.visitFunctionExpressionInvocation(node);
    }
  
    @override
    void visitFunctionDeclaration(FunctionDeclaration node) {
      try {
        final func = ProviderFunction(
          name: node.name.name,
          path: node.declaredElement!.declaration.location!.components.join('/'),
          line: node.name.offset,
        );
        if (RiverpodProviderUsageInfo.shouldMigrate(func)) {
          migrateFunctionDeclaration(node);
        }
  
        functionDecls[node.name.name] = node;
        migrateOnChangeFunction(node.name.name);
      } catch (e, st) {
        addError('before visiting function declaration\n$e\n$st');
      }
      super.visitFunctionDeclaration(node);
    }
  
    @override
    void visitMethodDeclaration(MethodDeclaration node) {
      try {
        if (node.name.name == 'build') {
          buildParams = node.parameters;
          functionBody = node.body;
          if (withinClass == ClassType.consumer) {
            // Consumer should be migrated regardless if providers are watched / read or not
            migrateParams(buildParams);
          }
        } else if (node.name.name == 'didUpdateProvider') {
          yieldPatch(
              ', ProviderContainer container',
              node.parameters!.parameters.last.end,
              node.parameters!.parameters.last.end);
          yieldPatch(
              ', Object? oldValue, ',
              node.parameters!.parameters.first.end,
              node.parameters!.parameters.last.offset);
        }
        final func = ProviderFunction(
          name: node.name.name,
          path: node.declaredElement!.declaration.location!.components.join('/'),
          line: node.name.offset,
        );
        if (node.name.name != 'build' &&
            RiverpodProviderUsageInfo.shouldMigrate(func)) {
          migrateMethodDeclaration(node);
        }
  
        methodDecls[node.name.name] = node;
        migrateOnChangeFunction(node.name.name);
      } catch (e, st) {
        addError('before visiting method declaration\n$e\n$st');
      }
      super.visitMethodDeclaration(node);
    }
  
  