ignoreCoderForField method

  1. @protected
bool ignoreCoderForField(
  1. FieldElement field,
  2. _FieldAnnotation annotation,
  3. SharedChecker<Model> checker
)

Determine whether this field should be included in generated output.

Implementation

@protected
bool ignoreCoderForField(
    FieldElement field, _FieldAnnotation annotation, SharedChecker<Model> checker) {
  final isComputedGetter = FieldsForClass.isComputedGetter(field);

  if (isComputedGetter && doesDeserialize) return true;
  if (annotation.ignore) return true;

  final hasGenerator =
      doesDeserialize ? annotation.fromGenerator != null : annotation.toGenerator != null;
  if (!checker.isSerializable && hasGenerator) return false;

  return !checker.isSerializable;
}