Skip to content

MenuItemButton may throw when updated with a null FocusNode #142095

Closed

Description

@davidhicks980

On the MenuItemButton widget, if widget.focusNode is updated to null, didUpdateWidget would throw.

Steps to reproduce

Change menu item focus node to null

Expected outcome

Doesn't throw

Actual outcome

Throws

Code sample
import 'package:flutter/material.dart';

/// Flutter code sample for [MenuAnchor].

void main() => runApp(const MenuApp());

class MenuApp extends StatelessWidget {
  const MenuApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(useMaterial3: true),
      home: const Scaffold(body: SafeArea(child: MyCascadingMenu())),
    );
  }
}

class MyCascadingMenu extends StatefulWidget {
  const MyCascadingMenu({super.key});

  @override
  State<MyCascadingMenu> createState() => _MyCascadingMenuState();
}

class _MyCascadingMenuState extends State<MyCascadingMenu> {
  late FocusNode? _buttonFocusNode = FocusNode();

  @override
  Widget build(BuildContext context) {
    return MenuAnchor(
      menuChildren: <Widget>[
        MenuItemButton(
            focusNode: _buttonFocusNode,
            closeOnActivate: false,
            child: Text("Set focus to null"),
            onPressed: () => setState(() {
                  _buttonFocusNode = null;
                })),
      ],
      builder:
          (BuildContext context, MenuController controller, Widget? child) {
        return TextButton(
          onPressed: () {
            if (controller.isOpen) {
              controller.close();
            } else {
              controller.open();
            }
          },
          child: const Text('OPEN MENU'),
        );
      },
    );
  }
}

Here is a gist demonstrating the bug in action on the Master branch: https://dartpad.dev/?id=a7da3f81557b11f7080b1f5a8afa0779&channel=master

Here is the code in the master material library: https://github.com/flutter/flutter/blob/b5262f0d80eb6da1b1cd6ceff0943367fbc29331/packages/flutter/lib/src/material/menu_anchor.dart#L1078C8-L1078C53

The code throws on both master and stable branches.

Relevate framework code
class _MenuItemButtonState extends State<MenuItemButton> {
  FocusNode? _internalFocusNode;
  FocusNode get _focusNode => widget.focusNode ?? _internalFocusNode!;

  // ...

  @override
  void didUpdateWidget(MenuItemButton oldWidget) {
    if (widget.focusNode != oldWidget.focusNode) {
      // **BUG?** If widget.focusNode changes to null, this appears to throw
      _focusNode.removeListener(_handleFocusChange);
      if (widget.focusNode != null) {
        _internalFocusNode?.dispose();
        _internalFocusNode = null;
      }
      _createInternalFocusNodeIfNeeded();
      _focusNode.addListener(_handleFocusChange);
    }
    super.didUpdateWidget(oldWidget);
  }

  // ...

  void _createInternalFocusNodeIfNeeded() {
    if (widget.focusNode == null) {
      _internalFocusNode = FocusNode();
      assert(() {
        if (_internalFocusNode != null) {
          _internalFocusNode!.debugLabel = '$MenuItemButton(${widget.child})';
        }
        return true;
      }());
    }
  }
}

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Jan 24, 2024
  2. huycozy commented on Jan 24, 2024

    @huycozy
    Member

    Hi @davidhicks980
    The goal of this Github repo is not to give assistance on personal code, but to improve flutter reporting bugs or feature requests.

    If you encounter behavior that you believe could be a Flutter framework bug, please try to provide all information indicated in the template so that we can address this issue properly (See bug issue template here).

    Instead, if you think that the issue might depend on your implementation, please see flutter's community for resources and ask questions like this. You may also get some help if you post it on Stack Overflow and flutterhelp.

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 24, 2024
  4. davidhicks980 commented on Jan 24, 2024

    @davidhicks980
    ContributorAuthor

    @huycozy
    My bad, I came across it while working on a different piece of code and wanted to make sure to flag it, but I should have filed a full report.

    Steps to reproduce

    Change menu item focus node to null

    Expected outcome

    Doesn't throw

    Actual outcome

    Throws

    Code sample
    import 'package:flutter/material.dart';
    
    /// Flutter code sample for [MenuAnchor].
    
    void main() => runApp(const MenuApp());
    
    class MenuApp extends StatelessWidget {
      const MenuApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          theme: ThemeData(useMaterial3: true),
          home: const Scaffold(body: SafeArea(child: MyCascadingMenu())),
        );
      }
    }
    
    class MyCascadingMenu extends StatefulWidget {
      const MyCascadingMenu({super.key});
    
      @override
      State<MyCascadingMenu> createState() => _MyCascadingMenuState();
    }
    
    class _MyCascadingMenuState extends State<MyCascadingMenu> {
      late FocusNode? _buttonFocusNode = FocusNode();
    
      @override
      Widget build(BuildContext context) {
        return MenuAnchor(
          menuChildren: <Widget>[
            MenuItemButton(
                focusNode: _buttonFocusNode,
                closeOnActivate: false,
                child: Text("Set focus to null"),
                onPressed: () => setState(() {
                      _buttonFocusNode = null;
                    })),
          ],
          builder:
              (BuildContext context, MenuController controller, Widget? child) {
            return TextButton(
              onPressed: () {
                if (controller.isOpen) {
                  controller.close();
                } else {
                  controller.open();
                }
              },
              child: const Text('OPEN MENU'),
            );
          },
        );
      }
    }

    Here is a gist demonstrating the bug in action on the Master branch: https://dartpad.dev/?id=a7da3f81557b11f7080b1f5a8afa0779&channel=master

    Here is the code in the master material library: https://github.com/flutter/flutter/blob/b5262f0d80eb6da1b1cd6ceff0943367fbc29331/packages/flutter/lib/src/material/menu_anchor.dart#L1078C8-L1078C53

    The code throws on both master and stable branches.

    I updated the original question with this text as well.

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 24, 2024
  6. huycozy commented on Jan 25, 2024

    @huycozy
    Member

    Thanks for the update. Also, I notice this issue only occurs if setting closeOnActivate to false.

    Output log
    Launching lib/menuitembutton_142095.dart on Chrome in debug mode...
    This app is linked to the debug service: ws://127.0.0.1:54429/qzW2VTg9BrI=/ws
    Debug service listening on ws://127.0.0.1:54429/qzW2VTg9BrI=/ws
    Connecting to VM Service at ws://127.0.0.1:54429/qzW2VTg9BrI=/ws
    ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
    The following TypeErrorImpl was thrown building
    RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#5865a](state:
    RawGestureDetectorState#7e051(gestures: <none>, behavior: opaque)):
    Unexpected null value.
    
    The relevant error-causing widget was:
      MenuAnchor
      MenuAnchor:file:///Users/huynq/Documents/NEVERCODE.IO/RepoduceProjects/reproduce_issues_2/lib/menuitembutton_142095.dart:32:12
    
    When the exception was thrown, this was the stack:
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 328:3       throw_
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 805:18  nullCheck
    packages/flutter/src/material/menu_anchor.dart 1058:69                            get [_focusNode]
    packages/flutter/src/material/menu_anchor.dart 1078:7                             didUpdateWidget
    packages/flutter/src/widgets/framework.dart 5652:55                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 3973:32                               updateChildren
    packages/flutter/src/widgets/framework.dart 6918:17                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5556:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5556:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5556:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5556:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/inherited_notifier.dart 105:11                       update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/inherited_notifier.dart 105:11                       update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5556:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5556:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5556:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5556:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/overlay.dart 2063:21                                 update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 6765:14                               update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5809:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 5666:5                                update
    packages/flutter/src/widgets/framework.dart 3824:14                               updateChild
    packages/flutter/src/widgets/framework.dart 5505:16                               performRebuild
    packages/flutter/src/widgets/framework.dart 5643:11                               performRebuild
    packages/flutter/src/widgets/framework.dart 5196:7                                rebuild
    packages/flutter/src/widgets/framework.dart 2904:18                               buildScope
    packages/flutter/src/widgets/binding.dart 989:9                                   drawFrame
    packages/flutter/src/rendering/binding.dart 443:5                                 [_handlePersistentFrameCallback]
    packages/flutter/src/scheduler/binding.dart 1386:7                                [_invokeFrameCallback]
    packages/flutter/src/scheduler/binding.dart 1311:9                                handleDrawFrame
    packages/flutter/src/scheduler/binding.dart 1169:5                                [_handleDrawFrame]
    lib/_engine/engine/platform_dispatcher.dart 1346:5                                invoke
    lib/_engine/engine/platform_dispatcher.dart 260:5                                 invokeOnDrawFrame
    lib/_engine/engine/initialization.dart 185:36                                     <fn>
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 550:37  _checkAndCall
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 555:39  dcall
    
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    
    flutter doctor -v (stable and master)
    [✓] Flutter (Channel stable, 3.16.8, on macOS 14.1 23B74 darwin-x64, locale en-VN)
        • Flutter version 3.16.8 on channel stable at /Users/huynq/Documents/GitHub/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 67457e669f (27 hours ago), 2024-01-16 16:22:29 -0800
        • Engine revision 6e2ea58a5c
        • Dart version 3.2.5
        • DevTools version 2.28.5
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-34, build-tools 34.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 15A507
        • CocoaPods version 1.14.3
    
    [✓] 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 Hedgehog.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)
    
    [✓] Android Studio (version 2022.2)
        • 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
        • android-studio-dir = /Applications/Android Studio.app/
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    
    [✓] VS Code (version 1.85.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.80.0
    
    [✓] Connected device (3 available)
        • iPhone (mobile) • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios            • iOS 15.8 19H370
        • macOS (desktop) • macos                                    • darwin-x64     • macOS 14.1 23B74 darwin-x64
        • Chrome (web)    • chrome                                   • web-javascript • Google Chrome 120.0.6099.234
    
    [✓] Network resources
        • All expected network resources are available.
    
    • No issues found!
    [!] Flutter (Channel master, 3.19.0-9.0.pre.139, on macOS 14.1 23B74 darwin-x64, locale en-VN)
        • Flutter version 3.19.0-9.0.pre.139 on channel master at /Users/huynq/Documents/GitHub/flutter_master
        ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 703e12f524 (83 minutes ago), 2024-01-24 17:49:08 -0800
        • Engine revision 4880592ca5
        • Dart version 3.4.0 (build 3.4.0-69.0.dev)
        • DevTools version 2.31.0
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-34, build-tools 34.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 15A507
        • CocoaPods version 1.14.3
    
    [✓] 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 Hedgehog.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)
    
    [✓] Android Studio (version 2022.2)
        • 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
        • android-studio-dir = /Applications/Android Studio.app/
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    
    [✓] VS Code (version 1.85.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.80.0
    
    [✓] Connected device (4 available)
        • RMX2001 (mobile) • EUYTFEUSQSRGDA6D                         • android-arm64  • Android 11 (API 30)
        • iPhone (mobile)  • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios            • iOS 15.8 19H370
        • macOS (desktop)  • macos                                    • darwin-x64     • macOS 14.1 23B74 darwin-x64
        • Chrome (web)     • chrome                                   • web-javascript • Google Chrome 120.0.6099.234
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
  7. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    a: error messageError messages from the Flutter framework
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-designOwned by Design Languages team
    and removed
    in triagePresently being triaged by the triage team
    on Jan 25, 2024
  8. davidhicks980 commented on Jan 25, 2024

    @davidhicks980
    ContributorAuthor

    I think that's because the MenuItem is unmounted before a new FocusNode is set, but I'll defer to you all on that.

  9. added
    r: fixedIssue is closed as already fixed in a newer version
    on Feb 1, 2024
  10. github-actions commented on Feb 15, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  11. locked as resolved and limited conversation to collaborators on Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: error messageError messages from the Flutter frameworkfound in release: 3.16Found to occur in 3.16found in release: 3.19Found to occur in 3.19frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions