DateTime? dateFromString(String? string) { if (string != null) { return DateTime.parse(string); } return null; }