Row constructor Null safety

  1. {Key? key,
  2. MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
  3. MainAxisSize mainAxisSize = MainAxisSize.max,
  4. CrossAxisAlignment crossAxisAlignment =,
  5. TextDirection? textDirection,
  6. VerticalDirection verticalDirection = VerticalDirection.down,
  7. TextBaseline? textBaseline,
  8. List<Widget> children = const <Widget>[]}

Creates a horizontal array of children.

The mainAxisAlignment, mainAxisSize, crossAxisAlignment, and verticalDirection arguments must not be null. If crossAxisAlignment is CrossAxisAlignment.baseline, then textBaseline must not be null.

The textDirection argument defaults to the ambient Directionality, if any. If there is no ambient directionality, and a text direction is going to be necessary to determine the layout order (which is always the case unless the row has no children or only one child) or to disambiguate start or end values for the mainAxisAlignment, the textDirection must not be null.


  Key? key,
  MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
  MainAxisSize mainAxisSize = MainAxisSize.max,
  CrossAxisAlignment crossAxisAlignment =,
  TextDirection? textDirection,
  VerticalDirection verticalDirection = VerticalDirection.down,
  TextBaseline? textBaseline, // NO DEFAULT: we don't know what the text's baseline should be
  List<Widget> children = const <Widget>[],
}) : super(
  children: children,
  key: key,
  direction: Axis.horizontal,
  mainAxisAlignment: mainAxisAlignment,
  mainAxisSize: mainAxisSize,
  crossAxisAlignment: crossAxisAlignment,
  textDirection: textDirection,
  verticalDirection: verticalDirection,
  textBaseline: textBaseline,