createArgFromBinds function
Implementation
Expression createArgFromBinds(
ServerBindsAnnotation annotation,
ServerParam param,
) {
var paramsRef = createClass(
annotation.bind.bind,
defaultArg: createGetFromDi(),
).property('bind').call([createBindContext(param)]).awaited;
final acceptsNull = annotation.acceptsNull;
if ((acceptsNull != null && !acceptsNull) || !param.isNullable) {
paramsRef = paramsRef.ifNullThen(
createMissingArgumentException(
key: param.name,
location: '@${AnnotationType.binds.name}',
).thrown.parenthesized,
);
}
return paramsRef;
}