IDX not picking up versionCode from pubspec.yaml file

The following error occurs and I have to explicitly set versionCode in build.gradle file for it to work. I’ve tried running flutter pub get from the terminal but same issue occurs.

2024-10-02T07:29:42Z [android] Starting preview…

2024-10-02T07:29:42Z [android] Flutter daemon started

2024-10-02T07:29:46Z [android] Launching lib/main.dart on Android SDK built for x86 in debug mode…

2024-10-02T07:29:46Z [android] Running Gradle task ‘assembleDebug’…

2024-10-02T07:30:16Z [android] Error:

2024-10-02T07:30:16Z [android]

2024-10-02T07:30:16Z [android] Error: FAILURE: Build failed with an exception.

2024-10-02T07:30:16Z [android]

2024-10-02T07:30:16Z [android] * Where:

2024-10-02T07:30:16Z [android] Build file ‘/home/user/stride/android/app/build.gradle’ line: 29

2024-10-02T07:30:16Z [android]

2024-10-02T07:30:16Z [android] Error:

2024-10-02T07:30:16Z [android] * What went wrong:

2024-10-02T07:30:16Z [android] A problem occurred evaluating project ‘:app’.

2024-10-02T07:30:16Z [android] > Could not get unknown property ‘versionCode’ for extension ‘flutter’ of type FlutterExtension.

The version code mentioned over here is not related to pubspec.yaml

Go to the bulild.gradle file and see if version is defined