# MissingPluginException: Timeout waiting for method call result on channel com.example.app/channel

- **ID:** `flutter/method-channel-timeout`
- **Domain:** flutter
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

Platform channel method call from Dart to native side timed out because the native handler never called result.success or result.error, often due to a missing plugin registration or a blocking main thread operation.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Flutter 3.16.0 | active | — | — |
| Flutter 3.22.0 | active | — | — |
| Dart 3.2.0 | active | — | — |

## Workarounds

1. **Ensure the native plugin is registered. In Android, check that the plugin class is added in MainActivity.kt/Java under configureFlutterEngine. For example, in MainActivity.kt:
  override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
    super.configureFlutterEngine(flutterEngine)
    flutterEngine.plugins.add(MyPlugin())
  }** (80% success)
   ```
   Ensure the native plugin is registered. In Android, check that the plugin class is added in MainActivity.kt/Java under configureFlutterEngine. For example, in MainActivity.kt:
  override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
    super.configureFlutterEngine(flutterEngine)
    flutterEngine.plugins.add(MyPlugin())
  }
   ```
2. **Verify that the native handler always calls result.success or result.error. In Android, wrap the method call implementation in a try-finally block to ensure result is invoked. Example:
  override fun onMethodCall(call: MethodCall, result: Result) {
    try {
      if (call.method == "getData") {
        result.success(fetchData())
      }
    } catch (e: Exception) {
      result.error("ERROR", e.message, null)
    }
  }** (85% success)
   ```
   Verify that the native handler always calls result.success or result.error. In Android, wrap the method call implementation in a try-finally block to ensure result is invoked. Example:
  override fun onMethodCall(call: MethodCall, result: Result) {
    try {
      if (call.method == "getData") {
        result.success(fetchData())
      }
    } catch (e: Exception) {
      result.error("ERROR", e.message, null)
    }
  }
   ```
3. **Run 'flutter clean' and 'flutter pub get' to re-register all plugins, then rebuild the app.** (75% success)
   ```
   Run 'flutter clean' and 'flutter pub get' to re-register all plugins, then rebuild the app.
   ```

## Dead Ends

- **Increase the default timeout duration in Dart code** — The timeout is not the root cause; the native side never responds, so extending the timeout only delays the failure. (70% fail)
- **Restart the Flutter app without cleaning the build cache** — If the plugin is not registered, restarting without cleaning retains the stale state; a clean build is required. (50% fail)
- **Wrap the method call in a try-catch and ignore the exception** — Ignoring the exception suppresses the error but leaves the underlying issue unresolved, leading to silent failures in other features. (90% fail)
