BaseMapping<M>.namedMapper constructor
const
BaseMapping<M>.namedMapper (
- String name
Creates a reference to a named mapper that will be injected at runtime.
Use this constructor when you want to provide a custom mapper through dependency injection. With this approach:
- You implement the mapper yourself
- Instantiate it outside of the generated code
- Provide it as a named parameter to
initRdfMapper
The name will appear as a parameter name in the generated initRdfMapper function.
Example:
// In your class property
@RdfProperty(
SchemaBook.price,
literal: LiteralMapping.namedMapper('priceMapper')
)
final Price price;
// Later when initializing mappers:
final rdfMapper = initRdfMapper(
priceMapper: myCustomPriceMapper
);
Implementation
const BaseMapping.namedMapper(String name)
: _mapperName = name,
_mapperType = null,
_mapperInstance = null,
_factoryName = null,
_factoryConfigInstance = null;