I have a function which loads data to TextFormField
from firebase .
can we supply controller
to the TextFormField
created by following function.
loadDataToTextFormField(
QuerySnapshot mySnapshot,
int index,
String databaseField,
String? bulletsAndNumberingType,
TextStyle textStyle) {
List getDataList = List.from(mySnapshot.docs[index][databaseField]);
return Column(
children: [
for (var i in getDataList)
Align(
alignment: Alignment.centerLeft,
child: TextFormField(
// controller: ?? how to supply controller here,
initialValue:
"$bulletsAndNumberingType $i",
style: (textStyle)
),
),
],
);
}
}
Any Help would be highly appriciated.
Thanks
2
Answers
Sorry i forgot
TextFormField
can't have both propertiescontroller
or 'initialValue' at oncce. It can have eithercontroller
or 'initialValue'.You can supply controller to the TextFormField by use following function.