How can I use controller as a string?

245

You need to access the text property.

TextEditingController.text

Replace it with your controller's name. i.e

usernameController.text
Share:
245
Kapil Kumar
Author by

Kapil Kumar

Updated on December 01, 2022

Comments

  • Kapil Kumar
    Kapil Kumar over 1 year

    I want to pass the controller as a String in an argument but the controller is of TextEditingController type. How can I change the type of controller as a String?

    • pskink
      pskink almost 3 years
      TextEditingController.text ?
    • Arslan Kaleem
      Arslan Kaleem almost 3 years
      You want the data of texteditingcontroller or controller itself. If you want controller data simply pass texteditingcontroller.text
    • Kapil Kumar
      Kapil Kumar almost 3 years
      thanks, it worked!!