Repository: flutter
Issue: Debugger error when debugging Flutter Web app with a class with a static function
Labels: tool,a: debugging,platform-web,has reproducible steps,P2,d: intellij,found in release: 2.2,found in release: 2.5,team-web,triaged-web

## Steps to Reproduce

When debugging a Flutter Web app, Android Studio's debugger shows an exception and prevents from examining variables when stepping into a function of a class that has a static function that returns an instance of the class, if the class' file name begins with a capital letter.

It's trivial to reproduce.

Create two classes, in two files:

*Dbg.dart*
```
class Dbg {
  static Dbg instance() { return Dbg(); }
  void test() {
    int a = 2; // <--- put breakpoint here
  }
}
```

*main.dart*
```
import 'Dbg.dart';

void main() {
  Dbg dbg = Dbg();
  dbg.test();
}
```

Put a breakpoint on the `int a = 2;` line, and run in debug mode (on a browser).

**Expected results:**
Once paused on the breakpoint, the debugger's Variables tool shows the in-scope variables.

**Actual results:**
Once paused on the breakpoint, the debugger's Variables tool shows an exception text.
Following is a screenshot, showing what it looks like, and the complete exception text:
![image](https://user-images.githubusercontent.com/1394039/128603005-97b1bbbc-3b2b-4a78-9983-40f82dbb2829.png)

Note: if I rename `Dbg.dart` to `dbg.dart` - the problem goes away.

Note 2: if I comment out the `static Dbg instance() { return Dbg(); }` line - the problem also goes away.

<details>
  <summary>Logs</summary>

`flutter analyze` just complains about the unused local variable `a`.

`flutter doctor -v`:
```
[✓] Flutter (Channel stable, 2.2.2, on Linux, locale en_US.UTF-8)
    • Flutter version 2.2.2 at /home/user/flutter
    • Framework revision d79295af24 (8 weeks ago), 2021-06-11 08:56:01 -0700
    • Engine revision 91c9fc8fe0
    • Dart version 2.13.3

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/user/Android/Sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /home/user/Downloads/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = chromium

[✓] Android Studio (version 4.2)
    • Android Studio at /home/user/Downloads/android-studio
    • Flutter plugin version 58.0.1
    • Dart plugin version 202.8488
    • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.2)
    • IntelliJ at /snap/intellij-idea-ultimate/current
    • 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

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Chromium 86.0.4240.75 snap

! Doctor found issues in 1 category.
```

</details>