We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi!
I have below an abstract class that maps one object to another:
abstract class ContractFromEntityMapper<C extends DataContract, E extends DomainEntity> { C? fromEntity(E? entity); }
Then I inherit this to another class which will also be used to generate the mapper:
@Mapper(useInjection: true) abstract class UserLoginContractFromEntityMapper extends ContractFromEntityMapper<UserLoginContract, UserLoginEntity> {}
After running build_runner, the generated file does not include fromEntity method:
build_runner
fromEntity
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'user_login_mapper.dart'; // ************************************************************************** // MapperGenerator // ************************************************************************** @LazySingleton(as: UserLoginContractFromEntityMapper) class UserLoginContractFromEntityMapperImpl extends UserLoginContractFromEntityMapper { UserLoginContractFromEntityMapperImpl() : super(); }
But when explicitly adding the fromEntity method in UserLoginContractFromEntityMapper:
UserLoginContractFromEntityMapper
@Mapper(useInjection: true) abstract class UserLoginContractFromEntityMapper extends ContractFromEntityMapper<UserLoginContract, UserLoginEntity> { @override UserLoginContract? fromEntity(UserLoginEntity? entity); }
the generated file is complete:
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'user_login_mapper.dart'; // ************************************************************************** // MapperGenerator // ************************************************************************** @LazySingleton(as: UserLoginContractFromEntityMapper) class UserLoginContractFromEntityMapperImpl extends UserLoginContractFromEntityMapper { UserLoginContractFromEntityMapperImpl() : super(); @override UserLoginContract? fromEntity(UserLoginEntity? entity) { if (entity == null) { return null; } ; final userlogincontract = UserLoginContract(email: entity.email, password: entity.password); return userlogincontract; } }
The text was updated successfully, but these errors were encountered:
Fix issue#56: Generator does not recognize inherited methods.
55356d9
smotastic#56 (comment)
fix: Generator does not recognize inherited methods smotastic#56
29c1c31
Fixed with #60
Sorry, something went wrong.
No branches or pull requests
Hi!
I have below an abstract class that maps one object to another:
Then I inherit this to another class which will also be used to generate the mapper:
After running
build_runner
, the generated file does not includefromEntity
method:But when explicitly adding the
fromEntity
method inUserLoginContractFromEntityMapper
:the generated file is complete:
The text was updated successfully, but these errors were encountered: