Add null safety check before displaying SnackBar (#1866)

pull/1867/head
Biso 2 years ago committed by GitHub
parent 0083ceb353
commit 51223a0efa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1475,9 +1475,12 @@ class _TimePickersState extends State<TimePickers> {
);
setState(() {
selectedTime = time;
if (selectedTime != null) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('Selected time: ${selectedTime!.format(context)}'),
content:
Text('Selected time: ${selectedTime!.format(context)}'),
));
}
});
},
child: const Text(

@ -1475,9 +1475,12 @@ class _TimePickersState extends State<TimePickers> {
);
setState(() {
selectedTime = time;
if (selectedTime != null) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('Selected time: ${selectedTime!.format(context)}'),
content:
Text('Selected time: ${selectedTime!.format(context)}'),
));
}
});
},
child: const Text(

Loading…
Cancel
Save