Using multiple parameters annotations
Here is a list of all the parameters annotations and where you can use them :
@withGetter
Member parameter
Any modddel
@validParam
Member parameter
SimpleEntity
@invalidParam
Member parameter
SimpleEntity
@NullFailure
Member parameter
Any modddel
@dependencyParam
Dependency parameter
Any modddel
You can annotate the same parameter with multiple annotations :
You can use
@withGetterwith any other member parameter annotationYou can use
@NullFailurewith@validParamFor Iterable2Entity, the member parameter can have up to two
@NullFailureannotations, one for eachmaskNb
However :
You can't use
@dependencyParamwith any annotation reserved to member parametersYou can't use
@NullFailurewith@invalidParam: That's because@invalidParamrequires a nullable parameter that is valid when it's null (See relevant section). If you want an alternative, see this section.You can't use
@validParamwith@invalidParam
Example :
factory Person({
@withGetter @NullFailure('identity', PersonIdentityFailure.unnamed()) required FullName? name,
required Age age,
@validParam @withGetter bool isAdult,
@dependencyParam AvailabilityService availabilityService,
})Last updated