admin管理员组

文章数量:1355660

I am developing a Flutter app, and I keep seeing this warning in my logs when pressing the back button:

W/WindowOnBackDispatcher(5979): sendCancelIfRunning: isInProgress=false callback=io.flutter.embedding.android.FlutterActivity$1@3957dc5

Questions:

  • What does this warning mean?
  • How can I resolve it or safely ignore it?
  • Does this affect my app’s UI performance?

Flutter Version: (Run flutter doctor -v and include the output)
Device/Emulator: (Specify if it happens only on an emulator or real device)
Android Version: (Mention the Android OS version you are testing on)

What I Have Tried

  1. Checked WillPopScope implementation:
    WillPopScope(
      onWillPop: () async {
        if (Navigator.of(context).canPop()) {
          Navigator.of(context).pop();
          return false;
        }
        return true;
      },
      child: Scaffold(
        appBar: AppBar(title: Text("Back Handling")),
        body: Center(child: Text("Press Back")),
      ),
    );
    
  2. Ran flutter upgrade to ensure I have the latest version.
  3. Tried running on both an emulator and a physical device, but the warning still appears.
  4. Checked MainActivity.kt, but I am not overriding any back button behavior.

I am developing a Flutter app, and I keep seeing this warning in my logs when pressing the back button:

W/WindowOnBackDispatcher(5979): sendCancelIfRunning: isInProgress=false callback=io.flutter.embedding.android.FlutterActivity$1@3957dc5

Questions:

  • What does this warning mean?
  • How can I resolve it or safely ignore it?
  • Does this affect my app’s UI performance?

Flutter Version: (Run flutter doctor -v and include the output)
Device/Emulator: (Specify if it happens only on an emulator or real device)
Android Version: (Mention the Android OS version you are testing on)

What I Have Tried

  1. Checked WillPopScope implementation:
    WillPopScope(
      onWillPop: () async {
        if (Navigator.of(context).canPop()) {
          Navigator.of(context).pop();
          return false;
        }
        return true;
      },
      child: Scaffold(
        appBar: AppBar(title: Text("Back Handling")),
        body: Center(child: Text("Press Back")),
      ),
    );
    
  2. Ran flutter upgrade to ensure I have the latest version.
  3. Tried running on both an emulator and a physical device, but the warning still appears.
  4. Checked MainActivity.kt, but I am not overriding any back button behavior.
Share Improve this question asked Mar 30 at 6:57 Sahil ParmarSahil Parmar 1
Add a comment  | 

1 Answer 1

Reset to default 0

You can safely ignore this warning unless you notice unexpected behavior in back navigation. It does not affect UI performance and is mainly a log message.

If you want a solution, then:

WillPopScope(
  onWillPop: () async {
    if (Navigator.of(context).canPop()) {
      Navigator.of(context).pop();
    } else {
      SystemNavigator.pop(); // You can close the app cleanly
    }
    return false; // Prevents Flutter from processing the back event further
  },
  child: Scaffold(
    appBar: AppBar(title: Text("Back Handling")),
    body: Center(child: Text("Press Back")),
  ),
);

This ensures that when there are no more screens to pop, SystemNavigator.pop() exits the app gracefully, preventing the warning.

本文标签: Flutter Warning WWindowOnBackDispatcher sendCancelIfRunningHow to FixStack Overflow