-
This is what the GET response looks like and this is how I want to cache it: {
"title" : "John",
"email": "john@example.com"
} However, in my case, I need to pass data like below in a POST request: {
"doc_id": "abc123",
"access_rule": "all",
"data": {
"title" : "John",
"email": "john@example.com"
}
} I can change my model to be the same as the POST request, but in the GET response it only contains the data part of the post request. Is it possible to make a structure that will be Document only in POST and PATCH, and T in GET? Is there any way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I was able to do this by copying the save method in the RemoteAdapter and making the following changes. If anyone has a new idea, please feel free to share, thanks. ...
final serialized = await serialize(model); // not changed
final newSerialized = {
'data': serialized,
'access_rule': 'all',
'doc_id': 'abc123',
};
final body = json.encode(newSerialized);
... |
Beta Was this translation helpful? Give feedback.
I was able to do this by copying the save method in the RemoteAdapter and making the following changes. If anyone has a new idea, please feel free to share, thanks.