elaborateResponse method

bool elaborateResponse(
  1. HttpResponse response
)

Implementation

bool elaborateResponse(HttpResponse response) {
  if (response.errors != null) {
    if (dialog) {
      Dialogs().showAlertDialog(
        context!,
        "Attenzione",
        Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: response.errors!.entries.map((entry) {
            return Column(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text("${entry.key}: "),
                for (var e in entry.value) Text(" - $e"),
              ],
            );
          }).toList(),
        ),
      );
    }

    return false;
  } else if (response.error != null) {
    if (dialog) {
      Dialogs()
          .showAlertDialog(context!, "Attenzione", Text(response.error!));
    }
    return false;
  } else if (response.dioException != null) {
    if (dialog) {
      Dialogs().showAlertDialog(
          context!, "Attenzione", Text(response.dioException!.message ?? ""));
    }
    return false;
  }

  return true;
}