Open outrelouxhe opened 4 months ago
For information, I have implemented the following workaround using a hook on the MappableClass:
class TranslatorMappingHook extends MappingHook {
const TranslatorMappingHook();
@override
Object? beforeDecode(Object? value) {
if (value is Map<String, dynamic>) {
// Set 'id' key with r'$id' value
if (value.containsKey(r'$id')) {
value['id'] = value[r'$id'];
}
}
return value;
}
}
Oh yes seems like a bug, will take a look
I need to use a raw string for one key because one of the API I'm using (appwrite) is storing the id of a record in the '$id' field. However, the generated file does not take into account the 'r' before the string and it creates an error and I need to update manually the generated file. I have also tried to escape the $ by adding a \ in front of it but id doesn't not work.
Am I missing something or is there a workaround ? Thank you
From TranslatorModelMapper :