createEventFormValidation method

dynamic createEventFormValidation()

Implementation

dynamic createEventFormValidation() {
  var eventData = EventService().eventNotificationModel!;
  if (eventData.group!.members == null ||
      // ignore: prefer_is_empty
      eventData.group!.members!.length < 1) {
    return 'Add contacts';
    // ignore: prefer_is_empty
  } else if (eventData.title == null || eventData.title!.trim().length < 1) {
    return 'Add title';
  } else if (eventData.venue == null ||
      eventData.venue!.label == null ||
      eventData.venue!.latitude == null ||
      eventData.venue!.longitude == null) {
    return 'Add venue';
  } else if (eventData.event!.isRecurring == null) {
    return 'Select Timings';
  } else if (eventData.event!.isRecurring == false &&
      checForOneDayEventFormValidation(eventData) is String) {
    return checForOneDayEventFormValidation(eventData);
  } else if (eventData.event!.isRecurring == true &&
      checForRecurringeDayEventFormValidation(eventData) is String) {
    return checForRecurringeDayEventFormValidation(eventData);
  } else {
    return true;
  }
}