getCount method Null safety

Future<LCStatusCount> getCount(
  1. {String? inboxType}
)

Counts the statuses of inboxType.

Implementation

static Future<LCStatusCount> getCount({String? inboxType}) async {
  LCUser? user = await LCUser.getCurrent();
  if (user == null) {
    throw ArgumentError.notNull('current user');
  }

  Map<String, dynamic> params = {
    OwnerKey: jsonEncode(_LCEncoder.encode(user))
  };
  if (!isNullOrEmpty(inboxType)) {
    params[InboxTypeKey] = inboxType;
  }
  Map response = await LeanCloud._httpClient
      .get('subscribe/statuses/count', queryParams: params);
  LCStatusCount statusCount = new LCStatusCount();
  statusCount.total = response['total'];
  statusCount.unread = response['unread'];
  return statusCount;
}