WidgetSpan constructor Null safety

const WidgetSpan(
  1. {required Widget child,
  2. PlaceholderAlignment alignment = ui.PlaceholderAlignment.bottom,
  3. TextBaseline? baseline,
  4. TextStyle? style}

Creates a WidgetSpan with the given values.

The child property must be non-null. WidgetSpan is a leaf node in the InlineSpan tree. Child widgets are constrained by the width of the paragraph they occupy. Child widget heights are unconstrained, and may cause the text to overflow and be ellipsized/truncated.

A TextStyle may be provided with the style property, but only the decoration, foreground, background, and spacing options will be used.


const WidgetSpan({
  required this.child,
}) : assert(child != null),
       baseline != null || !(
        identical(alignment, ui.PlaceholderAlignment.aboveBaseline) ||
        identical(alignment, ui.PlaceholderAlignment.belowBaseline) ||
        identical(alignment, ui.PlaceholderAlignment.baseline)