selectAll method Null safety

  1. @override
void selectAll(
  1. SelectionChangedCause cause
)
override

Select the entire text value.

Implementation

@override
void selectAll(SelectionChangedCause cause) {
  if (widget.readOnly && widget.obscureText) {
    // If we can't modify it, and we can't copy it, there's no point in
    // selecting it.
    return;
  }
  userUpdateTextEditingValue(
    textEditingValue.copyWith(
      selection: TextSelection(baseOffset: 0, extentOffset: textEditingValue.text.length),
    ),
    cause,
  );

  if (cause == SelectionChangedCause.toolbar) {
    switch (defaultTargetPlatform) {
      case TargetPlatform.android:
      case TargetPlatform.fuchsia:
      case TargetPlatform.linux:
      case TargetPlatform.windows:
        bringIntoView(textEditingValue.selection.extent);
        break;
      case TargetPlatform.macOS:
      case TargetPlatform.iOS:
        break;
    }
  }
}