getLogContent method

Future<(String?, UEmptyResponse?, String?)> getLogContent({
  1. required String logId,
  2. required dynamic onOk(
    1. String e
    )?,
  3. required VoidCallback? onError,
  4. required dynamic onException(
    1. String e
    )?,
})

Implementation

Future<(String?, UEmptyResponse?, String?)> getLogContent({
  required String logId,
  required Function(String r)? onOk,
  required VoidCallback? onError,
  required Function(String e)? onException,
}) async {
  (String?, UEmptyResponse?, String?) result = (null, null, null);
  await UHttpClient.send(
    method: "POST",
    endpoint: "${U.baseUrl}/dashboard/Logs/content",
    body: <String, String>{"id": logId},
    onSuccess: (Response r) {
      final String ok = r.body;
      result = (ok, null, null);
      onOk?.call(ok);
    },
    onError: (Response r) {
      final UEmptyResponse err = UEmptyResponse.fromJson(r.body);
      result = (null, err, null);
      onError?.call();
    },
    onException: (String e) {
      result = (null, null, e);
      onException?.call(e);
    },
  );
  return result;
}