asEdgeSpacing property

EdgeSpacingDirectional get asEdgeSpacing

Converts Flutter's EdgeInsetsDirectional to the flexbox EdgeSpacingDirectional equivalent.

This conversion preserves the directional nature of the insets, maintaining text-direction awareness (start/end instead of left/right). The resulting EdgeSpacingDirectional will respond appropriately to text direction changes.

All four sides (start, top, end, bottom) are converted to fixed spacing units with their corresponding pixel values.

Example:

final padding = EdgeInsetsDirectional.only(start: 16.0, end: 8.0);
final flexSpacing = padding.asEdgeSpacing; // EdgeSpacingDirectional with start: 16.0, end: 8.0

Implementation

EdgeSpacingDirectional get asEdgeSpacing => EdgeSpacingDirectional.only(
  start: SpacingUnit.fixed(start),
  top: SpacingUnit.fixed(top),
  end: SpacingUnit.fixed(end),
  bottom: SpacingUnit.fixed(bottom),
);