renderEquals static method

dynamic renderEquals(
  1. String clazz,
  2. Iterable<SerField> fields
)

Implementation

static renderEquals(String clazz, Iterable<SerField> fields) {
  if (fields.isEmpty) return '';
  return (LambdaContext _) => """
    @override
    bool operator ==(Object other) =>
        identical(this, other) ||
        other is $clazz &&
            runtimeType == other.runtimeType &&
            ${fields.map((e) {
        final id = e.id!.toCamelCase();
        return "this.$id == other.$id";
      }).join("&&")};
  """;
}