Repository: flutter
Issue: [3.22.0] Android App cannot build anymore on latest stable flutter version
Labels: platform-android,tool,a: build,a: release,P2,team-tool,triaged-tool

### Steps to reproduce

After running a build/run command such as:
```console
flutter build apk --release --no-tree-shake-icons
```
I started getting the following error after switching to stable flutter 3.22.0 (from 3.19.6): 
```console
Unhandled exception:
RangeError (offset): Invalid value: Not in inclusive range 0..324: 725
#0      RangeError.checkValueInInterval (dart:core/errors.dart:313)
#1      Source.getLocation (package:kernel/ast.dart:14992)
#2      Component.getLocation (package:kernel/ast.dart:14787)
#3      _getLocationInComponent (package:kernel/ast.dart:15181)
#4      Procedure._getLocationInEnclosingFile (package:kernel/ast.dart:3329)
#5      TreeNode._getLocationInEnclosingFile (package:kernel/ast.dart:207)
#6      TreeNode._getLocationInEnclosingFile (package:kernel/ast.dart:207)
#7      TreeNode._getLocationInEnclosingFile (package:kernel/ast.dart:207)
#8      TreeNode._getLocationInEnclosingFile (package:kernel/ast.dart:207)
#9      TreeNode.location (package:kernel/ast.dart:203)
#10     localFunctionName (package:vm/transformations/type_flow/utils.dart:449)
#11     SummaryCollector.createSummary (package:vm/transformations/type_flow/summary_collector.dart:628)
#12     TypeFlowAnalysis.getSummary (package:vm/transformations/type_flow/analysis.dart:1782)
#13     _DirectInvocation._processFunction (package:vm/transformations/type_flow/analysis.dart:398)
#14     _DirectInvocation.process (package:vm/transformations/type_flow/analysis.dart:287)
#15     _WorkList.processInvocation (package:vm/transformations/type_flow/analysis.dart:1663)
#16     _WorkList.process (package:vm/transformations/type_flow/analysis.dart:1606)
#17     TypeFlowAnalysis.process (package:vm/transformations/type_flow/analysis.dart:1811)
#18     transformComponent (package:vm/transformations/type_flow/transformer.dart:121)
#19     runGlobalTransformations (package:vm/kernel_front_end.dart:589)
#20     compileToKernel (package:vm/kernel_front_end.dart:489)
<asynchronous suspension>
#21     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:639)
<asynchronous suspension>
#22     starter (package:frontend_server/starter.dart:101)
<asynchronous suspension>
#23     main (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:13)
<asynchronous suspension>

Target kernel_snapshot failed: Exception


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/alexandrudochioiu/.asdf/installs/flutter/3.22.0-stable/bin/flutter'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 13s
Running Gradle task 'assembleRelease'...                           14.3s
Gradle task assembleRelease failed with exit code 1
```

### Expected results

App should be able to build/run

### Actual results

App fails to build or run on android

### Code sample

<details open><summary>Code sample</summary>

```dart
[Paste your code here]
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.22.0, on macOS 14.4.1 23E224 darwin-arm64, locale en-GB)
    • Flutter version 3.22.0 on channel stable at /Users/alexandrudochioiu/.asdf/installs/flutter/3.22.0-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (11 days ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/alexandrudochioiu/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/alexandrudochioiu/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Community Edition (version 2022.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.88.0

[✓] Connected device (3 available)
    • iPhone 15 Pro (mobile)          • 507C41EC-43C2-499A-BCA3-F0B1E40275AA • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 124.0.6367.208

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>