update method

  1. @override
Future<AdminModel> update(
  1. String id, {
  2. Map<String, dynamic> body = const {},
  3. Map<String, dynamic> query = const {},
  4. List<MultipartFile> files = const [],
  5. Map<String, String> headers = const {},
  6. String? expand,
  7. 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;
  });
}