TextSelectionOverlay constructor Null safety

TextSelectionOverlay(
  1. {required TextEditingValue value,
  2. required BuildContext context,
  3. Widget? debugRequiredFor,
  4. required LayerLink toolbarLayerLink,
  5. required LayerLink startHandleLayerLink,
  6. required LayerLink endHandleLayerLink,
  7. required RenderEditable renderObject,
  8. TextSelectionControls? selectionControls,
  9. bool handlesVisible = false,
  10. TextSelectionDelegate? selectionDelegate,
  11. DragStartBehavior dragStartBehavior,
  12. VoidCallback? onSelectionHandleTapped,
  13. ClipboardStatusNotifier? clipboardStatus}
)

Creates an object that manages overlay entries for selection handles.

The context must not be null and must have an Overlay as an ancestor.

Implementation

TextSelectionOverlay({
  required TextEditingValue value,
  required this.context,
  this.debugRequiredFor,
  required this.toolbarLayerLink,
  required this.startHandleLayerLink,
  required this.endHandleLayerLink,
  required this.renderObject,
  this.selectionControls,
  bool handlesVisible = false,
  this.selectionDelegate,
  this.dragStartBehavior = DragStartBehavior.start,
  this.onSelectionHandleTapped,
  this.clipboardStatus,
}) : assert(value != null),
     assert(context != null),
     assert(handlesVisible != null),
     _handlesVisible = handlesVisible,
     _value = value {
  final OverlayState? overlay = Overlay.of(context, rootOverlay: true);
  assert(
    overlay != null,
    'No Overlay widget exists above $context.\n'
    'Usually the Navigator created by WidgetsApp provides the overlay. Perhaps your '
    'app content was created above the Navigator with the WidgetsApp builder parameter.',
  );
  _toolbarController = AnimationController(duration: fadeDuration, vsync: overlay!);
}