google / google/built_value.dart

`FullType`s with generic input doesn't equal concrete type

Open
#1,189 1 comment 0 reactions 1 assignee Claimed by @davidmorgan View on GitHub
question
Dominant language
Dart
Stars
886
Forks
195
Avg merge
1d 11h
Merged PRs (30d)
4

Description

I'm trying to implement a REST API deserialisation with `built_value`. Because the general pattern for Responses ist always equal, I want to use a Generic to handle this part (I know I still have to registers the builder anyway).

The type of the serializer should be taken from the wrapping generic instead of passing another `FullType` with the concrete instances.

After a lot of trial and error I found the problem that causes the BuildFactory to not be found for the type.

TLDR; The `hashCode` for the concrete and from a generic derived `FullType` don't match.

A little sample:
```dart
fromGeneric() => FullType(BaseType, [FullType(TSerializeable)]);

final concrete = FullyType(BaseType, [FullType(Concrete)]);
final generic = fromGeneric ();

// should equal
concrete.hashCode == generic.hashCode
```

Is there a way to get them to equal somehow?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.