I initialize the initial value in TextEditingController but it shows an Error why?.
Error - The instance member 'data' can't be accessed in an initializer.
I am using a StatelessWidget and houseName is under UserRentModel class.
final UserRentModel data = Get.arguments['list'];
final houseNameController = TextEditingController(text: data.houseName);
I tried this code it works, but I think this type of code format is wrong.
final houseNameController = TextEditingController(text: Get
.arguments['list'].houseName);
.
Dart doesn't allow to direct telling that this data is equevalent to data you are passing to the model so to do it needs to be declared separately so try do it like this