serialize static method

Iterable<Map<String, Object?>> serialize(
  1. PlatformMenuItem group,
  2. PlatformMenuDelegate delegate, {
  3. required MenuItemSerializableIdGenerator getId,
})
override

Converts the supplied object to the correct channel representation for the 'flutter/menu' channel.

This API is supplied so that implementers of PlatformMenuItemGroup can share this implementation.

Implementation

static Iterable<Map<String, Object?>> serialize(
  PlatformMenuItem group,
  PlatformMenuDelegate delegate, {
  required MenuItemSerializableIdGenerator getId,
}) {
  return <Map<String, Object?>>[
    <String, Object?>{_kIdKey: getId(group), _kIsDividerKey: true},
    for (final PlatformMenuItem item in group.members)
      ...item.toChannelRepresentation(delegate, getId: getId),
    <String, Object?>{_kIdKey: getId(group), _kIsDividerKey: true},
  ];
}