tryToTimeOfDay method
Safe version that returns null if string is null or invalid
Implementation
TimeOfDay? tryToTimeOfDay(BuildContext context) {
if (this == null || this!.trim().isEmpty) return null;
try {
return this!.toTimeOfDay(context);
} catch (_) {
return null;
}
}