parseProperty static method

Property parseProperty(
  1. String definition, {
  2. Property? customParser(
    1. String name,
    2. String definition
    )?,
})

Implementation

static Property parseProperty(String definition,
    {Property? Function(String name, String definition)? customParser}) {
  final name = _getName(definition);
  switch (name) {
    case TextProperty.propertyNameUid:
    case TextProperty.propertyNameProductIdentifier:
    case TextProperty.propertyNameComment:
    case TextProperty.propertyNameDescription:
    case TextProperty.propertyNameSummary:
    case TextProperty.propertyNameLocation:
    case TextProperty.propertyNameResources:
    case TextProperty.propertyNameTimezoneId:
    case TextProperty.propertyNameTimezoneName:
    case TextProperty.propertyNameRelatedTo:
    case TextProperty.propertyNameXWrTimezone:
    case TextProperty.propertyNameXTimezoneLocation:
    case TextProperty.propertyNameXCalendarName:
    case TextProperty.propertyNameXMicrosoftSkypeTeamsMeetingUrl:
      return TextProperty(definition);
    case DateTimeProperty.propertyNameCompleted:
    case DateTimeProperty.propertyNameDue:
    case DateTimeProperty.propertyNameEnd:
    case DateTimeProperty.propertyNameStart:
    case DateTimeProperty.propertyNameTimeStamp:
    case DateTimeProperty.propertyNameCreated:
    case DateTimeProperty.propertyNameLastModified:
    case DateTimeProperty.propertyNameRecurrenceId:
      return DateTimeProperty(definition);
    case IntegerProperty.propertyNamePercentComplete:
    case IntegerProperty.propertyNameSequence:
    case IntegerProperty.propertyNameRepeat:
      return IntegerProperty(definition);
    case BooleanProperty.propertyNameAllDayEvent:
      return BooleanProperty(definition);
    case CalendarScaleProperty.propertyName:
      return CalendarScaleProperty(definition);
    case UtfOffsetProperty.propertyNameTimezoneOffsetFrom:
    case UtfOffsetProperty.propertyNameTimezoneOffsetTo:
      return UtfOffsetProperty(definition);
    case RecurrenceRuleProperty.propertyName:
      return RecurrenceRuleProperty(definition);
    case UriProperty.propertyNameTimezoneUrl:
    case UriProperty.propertyNameUrl:
      return UriProperty(definition);
    case GeoProperty.propertyName:
      return GeoProperty(definition);
    case AttendeeProperty.propertyName:
      return AttendeeProperty(definition);
    case OrganizerProperty.propertyName:
      return OrganizerProperty(definition);
    case UserProperty.propertyNameContact:
      return UserProperty(definition);
    case VersionProperty.propertyName:
      return VersionProperty(definition);
    case AttachmentProperty.propertyName:
      return AttachmentProperty(definition);
    case CategoriesProperty.propertyName:
      return CategoriesProperty(definition);
    case ClassificationProperty.propertyName:
      return ClassificationProperty(definition);
    case PriorityProperty.propertyName:
      return PriorityProperty(definition);
    case StatusProperty.propertyName:
      return StatusProperty(definition);
    case DurationProperty.propertyName:
      return DurationProperty(definition);
    case TimeTransparencyProperty.propertyName:
      return TimeTransparencyProperty(definition);
    case FreeBusyProperty.propertyName:
      return FreeBusyProperty(definition);
    case ActionProperty.propertyName:
      return ActionProperty(definition);
    case TriggerProperty.propertyName:
      return TriggerProperty(definition);
    case RecurrenceDateProperty.propertyNameRDate:
    case RecurrenceDateProperty.propertyNameExDate:
      return RecurrenceDateProperty(definition);
    case MethodProperty.propertyName:
      return MethodProperty(definition);
    case RequestStatusProperty.propertyName:
      return RequestStatusProperty(definition);
    case EventBusyStatusProperty.propertyName:
      return EventBusyStatusProperty(definition);
    default:
      if (customParser != null) {
        final prop = customParser(name, definition);
        if (prop != null) {
          return prop;
        }
      }
      print('No property implementation found for $definition');
      return Property(definition, ValueType.text);
  }
}