build method

dynamic build(
  1. String type,
  2. dynamic propValue, {
  3. dynamic argument,
})

Returns a result from a Property's type and propValue.

Implementation

dynamic build(String type, dynamic propValue, {dynamic argument}) {
  if (!_builders.containsKey(type) || _builders[type] == null) {
    log.severe("Property resolver for '$type' not found");
    return propValue;
  }
  var func = _builders[type]!;
  if (propValue is Map && propValue["_type"] is String) {
    // Check if the "_type" subtype has its own resolver
    final subtype = propValue["_type"] as String;
    if (_builders.containsKey(subtype) && _builders[subtype] != null) {
      func = _builders[subtype]!;
    }
  }
  if (func is ValueSpecBuildFunction) {
    return func(argument, propValue);
  } else {
    return func(propValue);
  }
}