Closed yadferhad closed 7 months ago
Here's an example of a custom endpoint, notice that calling super.onSuccess
will do the default deserializing/saving handling. It knows how to handle single and multiple models, have a look at it and see if you can pass it data such that it handles multiple. Otherwise you can roll your own.
Future<List<User>> saveUsers(...) async {
return sendRequest(
// ...
onSuccess: (data, label) async {
// calling super.onSuccess will deserialize & save
var users = await super.onSuccess(data, label);
// ...
return users;
},
);
}
How can we do batch operations (creating multiple data at the same time, but calling the server just once for saving) with flutter_data? If we use a custom endpoint, how do we handle the local version?