useTextEditingController top-level constant

TextEditingControllerHookCreator const useTextEditingController

A TextEditingController of the first build, of a text, or of a value (useTextEditingController.fromValue), made anew when the keys of a build differ from the last one's; the text of later builds is ignored.

A field that starts with a name and says how long it is:

HookBuilder(
  builder: (context) {
    final controller = useTextEditingController(text: 'Ada');
    useListenable(controller);
    return Column(
      children: [
        TextField(controller: controller),
        Text('${controller.text.length} characters'),
      ],
    );
  },
)

Implementation

const useTextEditingController = TextEditingControllerHookCreator._();