getDescendants method Null safety

List<MenuItem> getDescendants(
  1. PlatformMenu item
)

Returns all descendants of the given item.

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

Implementation

static List<MenuItem> getDescendants(PlatformMenu item) {
  return <MenuItem>[
    for (final MenuItem child in item.menus) ...<MenuItem>[
      child,
      ...child.descendants,
    ],
  ];
}