registerField static method

void registerField({
  1. required String field,
  2. dynamic function(
    1. String value,
    2. Map<String, String> params,
    3. List event,
    4. Map<String, dynamic> lastEvent,
    )?,
})

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,
  Function(String value, Map<String, String> params, List event,
          Map<String, dynamic> lastEvent)?
      function,
}) {
  if (_objects.containsKey(field)) {
    throw ICalendarFormatException('The field $field is already registered.');
  }

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