ignoreCoderForField method

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

Determine whether this field should be included in generated output.

Implementation

@override
bool ignoreCoderForField(field, annotation, checker) {
  if (annotation.columnType != null) {
    if (checker.isSerializable) return false;

    if (doesDeserialize) {
      if (annotation.fromGenerator == null) {
        throw InvalidGenerationSourceError(
            'Decalaring column type ${annotation.columnType} on ${field.name} requires `fromGenerator` to be declared');
      }
    } else {
      if (annotation.toGenerator == null) {
        throw InvalidGenerationSourceError(
            'Decalaring column type ${annotation.columnType} on ${field.name} requires `toGenerator` to be declared');
      }
    }

    return false;
  }

  return super.ignoreCoderForField(field, annotation, checker);
}