asFlexItem property

Widget get asFlexItem

Explicitly wraps this widget as a FlexItem.

This is useful when you want to ensure the widget participates in flex layout but haven't applied any other flex-specific properties yet. Most of the time this is not needed as other methods like flexGrow and flexShrink automatically wrap in a FlexItem.

Example:

Container().asFlexItem,

Implementation

Widget get asFlexItem {
  return _WidgetWrapper._wrapOrCopyWith(
    child: this,
    childType: () => FlexItem,
  );
}