In the following code, I have implemented a textfield and its value will be stored by _getVin. But I am receiving null value before user is able to enter a value. So what will be a correct solution ? What are the changes to be made?
@override
Widget build(BuildContext context) {
TextEditingController _getVin = TextEditingController();
var vin = VIN(number: _getVin.text, extended: true);
return new Scaffold (
body: Container(
padding: new EdgeInsets.only(top: 16.0),
child: TextField(
controller: _getVin,
decoration:InputDecoration(
border :OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
borderSide: BorderSide(color:Colors.black)
),
labelText: "Enter VIN",
labelStyle: TextStyle(
fontSize: 15,
color:Colors.black
),
),
),
),
GestureDetector(
onTap:() {
print(_getVin);
print(vin.modelYear());
},
child:Card(
child: Text( "Press Here"),
)
),