delete method

  1. @override
Future<void> delete(
  1. String id, {
  2. Map<String, dynamic> body = const {},
  3. Map<String, dynamic> query = const {},
  4. Map<String, String> headers = const {},
})
override

Deletes a single admin model by its id.

If the current AuthStore.model matches with the deleted id, then on success the client AuthStore will be also cleared.

Implementation

@override
Future<void> delete(
  String id, {
  Map<String, dynamic> body = const {},
  Map<String, dynamic> query = const {},
  Map<String, String> headers = const {},
}) {
  return super
      .delete(
    id,
    body: body,
    query: query,
    headers: headers,
  )
      .then((_) {
    if (client.authStore.model != null &&
        client.authStore.model is AdminModel &&
        (client.authStore.model as AdminModel).id == id) {
      client.authStore.clear();
    }

    return;
  });
}