serdesValueForField method

  1. @protected
String serdesValueForField(
  1. FieldElement field,
  2. String annotatedName, {
  3. required SharedChecker<Model> checker,
})
inherited

The field's value when used by the generator. For example, data['my_field'] when used by a deserializing generator or instance.myField when used by a serializing generator

Implementation

@protected
String serdesValueForField(
  FieldElement field,
  String annotatedName, {
  required SharedChecker checker,
}) {
  if (doesDeserialize) {
    final name = providerNameForField(annotatedName, checker: checker);
    return "data['$name']";
  }

  return 'instance.${field.name}';
}