read method

void read({
  1. required UCommentReadParams p,
  2. required dynamic onOk(
    1. UResponse<List<UCommentResponse>> r
    ),
  3. required dynamic onError(
    1. UResponse e
    ),
  4. dynamic onException(
    1. Exception
    )?,
})

Implementation

void read({
  required final UCommentReadParams p,
  required final Function(UResponse<List<UCommentResponse>> r) onOk,
  required final Function(UResponse<dynamic> e) onError,
  final Function(Exception)? onException,
}) =>
    httpClient.post(
      "/comment/Read",
      body: p.toMap().add("apiKey", apiKey).add("token", token),
      onSuccess: (final String r) => onOk(
        UResponse<List<UCommentResponse>>.fromJson(
          r,
          (final dynamic i) => List<UCommentResponse>.from((i as List<dynamic>).map((final dynamic x) => UCommentResponse.fromMap(x))),
        ),
      ),
      onError: (final String r) => onError(UResponse<dynamic>.fromJson(r, (final dynamic i) => i)),
      onException: (final dynamic e) {
        if (onException != null) onException(e);
      },
    );