-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Dart 3 recods #58
Comments
To implement for the Dart 3 records, in my opinion, I think it would be better to first convert it to a map first for it to work, for example like a final record1 = (2, 'hello', true);
print(record1.toMap()) // prints {'$1': 2, '$2' : 'hello', '$3' : true} but it seems difficult to implement. And it is almost impossible according to what is here. |
I haven't looked much into it, but I initially thought we could get positional and named things out of it, similar to the constructor, and do something about it? |
Oh, yes, thanks, I just found out there is |
I've been trying to mess around with some things, what if we have the type extension DartTypeExtension on DartType {
bool get isPrimitiveType =>
isDartCoreNum ||
isDartCoreInt ||
isDartCoreDouble ||
isDartCoreString ||
isDartCoreBool ||
isDartCoreEnum ||
isDartCoreSymbol ||
isDartCoreRecord;
} And have something like this @AutoMappr([
MapType<RecordHolderDto, RecordHolder>(),
])
class Mappr extends $Mappr {}
class RecordHolder {
final Record value;
RecordHolder(this.value);
}
class RecordHolderDto {
final Record value;
RecordHolderDto(this.value);
} I still doubt if this is right, but I just want show it, before I create a PR. |
I think the difference between primitives and iterable/map right now is that we pass a primitive just like that, and we map each part of iterable/map. Meaning in the Iterable I can have I am not sure how the records mapping should work exactly either because we didn't use it yet. :D That is what this issue is about -- do research and probably do it similarly to list/map mappings. It's for sure a tricky issue to do. |
Yes, it is quite tricky one to implement. I will make more findings and try to imitate that of map/list. |
Will be available in v2 |
Implement support for record types.
Note: we might merge it even before we have Dart 3 since the analyzer already can know the record type.
The text was updated successfully, but these errors were encountered: