initState method

  1. @override
void initState()
override

Initialise the controller.

Implementation

@override
void initState() {
  super.initState();
  _controller = TextEditingController(
    text: widget.text ?? '',
  );
  final textLength = widget.text?.length ?? 0;
  _controller.selection = TextSelection(
    baseOffset: 0,
    extentOffset: textLength,
  );
  _formKey = GlobalKey<FormState>();
}