leanflutter / tray_manager

This plugin allows Flutter desktop apps to defines system tray.
https://pub.dev/packages/tray_manager
MIT License
230 stars 36 forks source link

Fix flutter beta error regarding MenuItem import #14

Closed simonbengtsson closed 2 years ago

simonbengtsson commented 2 years ago

There is an error when using this library with the most recent flutter beta (2.13.0-0.1.pre) which can be fixed by simply removing an unused import of material.dart.

The name 'MenuItem' is defined in the libraries 'package:flutter/src/widgets/platform_menu_bar.dart' and 
'package:tray_manager/src/menu_item.dart (via package:tray_manager/tray_manager.dart)'

An easy way for client code to fix this is to hide the MenuItem import from material if this is not needed.

import 'package:flutter/material.dart' hide MenuItem;

Basically the MenuItem class name collides with a new class in flutter which was added in this commit. There is some mentions of the plans for flutter to add native menu bar support in the flutter roadmap which can be read more about in this ticket https://github.com/flutter/flutter/issues/23600.

lijy91 commented 2 years ago

LGTM