google / flutter-desktop-embedding

Experimental plugins for Flutter for Desktop
Apache License 2.0
7.1k stars 604 forks source link

[menubar] 'MenuItem' is imported from both 'package:flutter/src/widgets/platform_menu_bar.dart' and 'package:menubar/src/menu_item.dart' #902

Closed AgnelSelvan closed 2 years ago

AgnelSelvan commented 2 years ago

Is this a bug in one of the plugins in this project?

Which plugin is this bug report about?

menubar

Describe the bug

Im using Windows 11, After upgrading from Flutter Version 2 to latest version, i.e Flutter V 3.0.4 I'm getting this particular error

/C:/src/flutter/.pub-cache/git/flutter-desktop-embedding-5c51870ced62a00e809ba4b81a846a052d241c9f/plugins/menubar/lib/src/menu_channel.dart(19,1): error GD26961E6: 'MenuItem' is imported from both 'package:flutter/src/widgets/platform_menu_bar.dart' and 'package:menubar/src/menu_item.dart'. [path\to\project\build\windows\flutter\flutter_assemble.vcxproj]

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(245,5): error MSB8066: Custom build for 'path\to\project\build\windows\CMakeFiles\35bdcf3b678269ad2c9ea788c0dbc6c5\flutter_windows.dll.rule;path\to\project\build\windows\CMakeFiles\a0f4c5dbf216fa51231bbc5c8c02a604\flutter_assemble.rule' exited with code 1. [path\to\project\build\windows\flutter\flutter_assemble.vcxproj]

In pubspec.yaml I have added this dependencies

menubar:
    git:
      url: https://github.com/google/flutter-desktop-embedding.git
      path: plugins/menubar
      ref: 5c51870ced62a00e809ba4b81a846a052d241c9f

and In the code I'm accessing like this

import 'package:menubar/menubar.dart' as menubar;

  menubar.Submenu(
    label: 'Add',
    children: [
      menubar.MenuItem(
          label: "Home",
          onClicked: () {
          },
        )
    ]
  )

Flutter doctor

[√] Flutter (Channel stable, 3.0.4, on Microsoft Windows [Version 10.0.21996.1], locale en-IN)
    • Flutter version 3.0.4 at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (6 days ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at C:\Users\nesan\AppData\Local\Android\sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.1.32407.343
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 11.0.11+9-b60-7590822)

[√] VS Code (version 1.68.1)
    • VS Code at C:\Users\nesan\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.44.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.21996.1]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 103.0.5060.114
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 102.0.1245.44

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
stuartmorgan commented 2 years ago

Thanks for the report!

You can update to the latest hash, and adjust for the API changes described in https://github.com/google/flutter-desktop-embedding/pull/903, and then it will work with 3.0.