getConvert4 static method

Convert getConvert4(
  1. Type type
)

Implementation

static Convert getConvert4(Type type) {
  Convert? result = type2Converters[type];

  if ( result == null) {
    var descriptor = TypeDescriptor.forType(type);
    var instance = descriptor.constructor!();

    if (instance is Convert) {
      result = instance;
      type2Converters[type] = instance;
    }
    else
      throw Exception("not a convert");
  }

  return result;
}