updateMenuItem method
Updates a menu item's properties.
itemId is the identifier of the menu item to update.
title is the new title (null to keep current).
enabled is the new enabled state (null to keep current).
Returns true if the menu item was successfully updated.
Implementation
@override
Future<bool> updateMenuItem({
required String itemId,
String? title,
bool? enabled,
}) async {
try {
final result = await methodChannel
.invokeMethod<bool>('updateMenuItem', <String, dynamic>{
'itemId': itemId,
if (title != null) 'title': title,
if (enabled != null) 'enabled': enabled,
});
return result ?? false;
} on PlatformException catch (e) {
debugPrint('Error updating menu item: ${e.message}');
return false;
}
}