applyProtocolReferences method

TypeDefinition applyProtocolReferences(
  1. List<SerializableModelDefinition> classDefinitions
)

Applies protocol references. This makes the protocol: prefix optional. First, the protocol definition is parsed, then it's check for the protocol: prefix in types. Whenever no url is set and user specified a class/enum with the same symbol name it defaults to the protocol: prefix.

Implementation

TypeDefinition applyProtocolReferences(
    List<SerializableModelDefinition> classDefinitions) {
  return TypeDefinition(
      className: className,
      nullable: nullable,
      customClass: customClass,
      dartType: dartType,
      generics: generics
          .map((e) => e.applyProtocolReferences(classDefinitions))
          .toList(),
      enumDefinition: enumDefinition,
      url:
          url == null && classDefinitions.any((c) => c.className == className)
              ? defaultModuleAlias
              : url);
}