acceptProperties method

  1. @override
List<HandledPaths> acceptProperties(
  1. JsonPath? basePath,
  2. IMSchemaDefinition definition,
  3. Map<JsonPath, IMSchemaProperty> available
)
override

Examines a form, and returns a list of properties that this handler is capable of dealing with, grouped together in HandledPaths. Each of these field clusters will be passed back to the handler during rendering

Implementation

@override
List<HandledPaths> acceptProperties(
    JsonPath? basePath, IMSchemaDefinition definition, Map<JsonPath, IMSchemaProperty> available) {
  IMSchemaProperty? durationUnit;
  IMSchemaProperty? durationAmount;

  available.forEach((path, prop) {
    if (path.last == "durationUnit") durationUnit = prop;
    if (path.last == "durationAmount") durationAmount = prop;
  });

  return [
    if (durationUnit != null && durationAmount != null)
      HandledPaths.ofProperties({durationAmount, durationUnit}, basePath!, this,
          data: {
            DurationProperty.unit: durationUnit,
            DurationProperty.amount: durationAmount,
          }),
  ];
}