toChannelRepresentation method Null safety

  1. @override
Iterable<Map<String, Object?>> toChannelRepresentation(
  1. PlatformMenuDelegate delegate,
  2. {required int index,
  3. required int count,
  4. 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 index is the position of this menu item in the list of children of the PlatformMenu it belongs to, and count is the number of children in the PlatformMenu it belongs to.

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.


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