toChannelRepresentation method

Iterable<Map<String, Object?>> toChannelRepresentation(
  1. PlatformMenuDelegate delegate,
  2. {required MenuItemSerializableIdGenerator getId}
)

Converts the representation of this item into a map suitable for sending over the default "flutter/menu" channel used by DefaultPlatformMenuDelegate.

The delegate is the PlatformMenuDelegate that is requesting the serialization.

The getId parameter is a MenuItemSerializableIdGenerator function that generates a unique ID for each menu item, which is to be returned in the "id" field of the menu item data.

Implementation

Iterable<Map<String, Object?>> toChannelRepresentation(
  PlatformMenuDelegate delegate, {
  required MenuItemSerializableIdGenerator getId,
}) {
  return <Map<String, Object?>>[PlatformMenuItem.serialize(this, delegate, getId)];
}