registerField static method

void registerField({
  1. required String field,
  2. SimpleParamFunction? function,
})

Allow to add custom field to parse.

If no function parameter to parse the field is provided the default method generateSimpleParamFunction will be used.

If a field with the same name already exists the method will throw a ICalendarFormatException.

Implementation

static void registerField({
  required String field,
  SimpleParamFunction? function,
}) {
  if (_objects.containsKey(field)) {
    throw ICalendarFormatException('The field $field is already registered.');
  }

  _objects[field] =
      function ?? generateSimpleParamFunction(field.toLowerCase());
}