NestMapping constructor

NestMapping(
  1. MethodElement method,
  2. VariableElement input
)

Implementation

NestMapping(this.method, this.input) {
  methodReturnNullable = method.returnType.nullabilitySuffix == NullabilitySuffix.question;
  inputNullable = input.type.nullabilitySuffix == NullabilitySuffix.question;
  methodParamterNullable = method.parameters.first.type.nullabilitySuffix == NullabilitySuffix.question;

  returnNullable =
    (inputNullable && !methodParamterNullable) ||     // 'a == null ? null : call(a)'. So the output is nullable.
    (inputNullable && methodReturnNullable);          // if input is not null, the method return is not
}