Try this:
TextFormField(
decoration: const InputDecoration(
icon: Icon(Icons.phone),
hintText: 'Enter a phone number',
labelText: 'Phone',
),
validator: (value) {
if (value!.isEmpty) {
return 'Please enter phone number';
}
return null;
},
),
TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.phone),
hintText: 'Enter a phone number',
labelText: 'Phone',
),
validator: (value) {
if (value!.isEmpty) {
return 'Please enter phone number';
}
return null;
},
),
use `value!.isEmpty` instead of `value.isEmpty`.