update method
Future<AdminModel>
update(
- String id, {
- Map<
String, dynamic> body = const {}, - Map<
String, dynamic> query = const {}, - List<
MultipartFile> files = const [], - Map<
String, String> headers = const {}, - String? expand,
- String? fields,
override
Updates a single admin model by its id.
If the current AuthStore.model matches with the updated id, then on success the client AuthStore will be updated with the result model.
Implementation
@override
Future<AdminModel> update(
String id, {
Map<String, dynamic> body = const {},
Map<String, dynamic> query = const {},
List<http.MultipartFile> files = const [],
Map<String, String> headers = const {},
String? expand,
String? fields,
}) {
return super
.update(
id,
body: body,
query: query,
files: files,
headers: headers,
expand: expand,
fields: fields,
)
.then((item) {
if (client.authStore.model != null &&
client.authStore.model is AdminModel &&
(client.authStore.model as AdminModel).id == item.id) {
client.authStore.save(client.authStore.token, item);
}
return item;
});
}