Repository: flutter
Issue: Missing "Create Method" Option in Context Menu for Bloc Event Handlers in Latest Flutter
Labels: waiting for customer response,in triage

### Steps to reproduce

In Android Studio, the "Create method" option for Bloc event handlers is available in the context menu when using Flutter 3.24 but is missing in Flutter 3.27. This inconsistency makes it harder to create event handler methods in newer Flutter versions, even when using the latest Android Studio (Ladybug Feature Drop | 2024.2.2).

1. Open a Flutter project with Bloc in Flutter 3.24.
2. Right-click on a missing event handler in on<Event> or press Option + Enter – observe the "Create method" option in the context menu.

1. Open a Flutter project with Bloc in Flutter 3.27.
2. Perform the same action (right-click or Option + Enter) – notice the "Create method" option is missing.

### Expected results

The "Create method" option should appear in the context menu consistently when working with missing Bloc event handlers in any Flutter version.

### Actual results

- In Flutter 3.24, the "Create method" option appears in the context menu.
- In Flutter 3.27, the "Create method" option is missing in the context menu, requiring manual method creation.

### Code sample

<details open><summary>Code sample</summary>

```dart
class LoginBloc extends Bloc<LoginEvent, LoginState> {
  LoginBloc() : super(LoginState.initial()) {
    on<_Started>(_onStarted);
    on<_EmailChanged>(_onEmailChanged);
  }

  FutureOr<void> _onStarted(
    _Started event,
    Emitter<LoginState> emit,
  ) async {}
}

part of 'login_bloc.dart';

@freezed
abstract class LoginEvent with _$LoginEvent {
  const factory LoginEvent.started() = _Started;
  const factory LoginEvent.emailChanged(String email) = _EmailChanged;
  const factory LoginEvent.passwordChanged(String password) = _PasswordChanged;
  const factory LoginEvent.formSubmitted() = _FormSubmitted;
}

part of 'login_bloc.dart';

@freezed
class LoginState with _$LoginState {
  const factory LoginState({
    @Default(Email.pure()) Email email,
    @Default(Password.pure()) Password password,
    @Default(UiState.initial()) UiState<User> formSubmissionUiState,
  }) = _LoginState;

  factory LoginState.initial() => const LoginState();
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>


**Flutter 3.24 – "Create method" option appears in context menu:**

<img width="491" alt="Image" src="https://github.com/user-attachments/assets/f97038ee-ac32-45be-90b4-9ed0b6314961" />

**Flutter 3.27 – "Create method" option missing in context menu:**

<img width="501" alt="Image" src="https://github.com/user-attachments/assets/aaadb85f-60bf-405d-b5fa-16d968a9df67" />

</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.27.2, on macOS 15.1.1 24B91 darwin-arm64, locale en-TH)
    • Flutter version 3.27.2 on channel stable at /Users/toelie/Developer/Tools/Flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 68415ad1d9 (8 days ago), 2025-01-13 10:22:03 -0800
    • Engine revision e672b006cb
    • Dart version 3.6.1
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/toelie/Developer/Tools/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/toelie/Developer/Tools/Android/sdk
    • ANDROID_SDK_ROOT = /Users/toelie/Developer/Tools/Android/sdk
    • Java binary at: /opt/homebrew/opt/openjdk@17/bin/java
    • Java version OpenJDK Runtime Environment Homebrew (build 17.0.13+0)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16A242d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio Iguana.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.9+0-17.0.9b1087.7-11185874)

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/Android Studio Ladybug.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 21.0.4+-12422083-b607.1)

[✓] VS Code (version 1.96.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554         • android-arm64  • Android 15 (API 35) (emulator)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 15.1.1 24B91 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 15.1.1 24B91 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 132.0.6834.83

[✓] Network resources
    • All expected network resources are available.

• No issues found!

```

</details>