sendPrivately method Null safety

Future<LCStatus> sendPrivately(
  1. LCStatus status,
  2. String targetId
)

Send a status from current signined user to private inbox of targetId.

Implementation

static Future<LCStatus> sendPrivately(
    LCStatus status, String targetId) async {
  LCUser? user = await LCUser.getCurrent();
  if (user == null) {
    throw ArgumentError.notNull('current user');
  }

  status.data[SourceKey] = user;

  LCQuery<LCObject> query = new LCQuery('_User');
  query.whereEqualTo('objectId', targetId);
  status.query = query;

  status.inboxType = InboxTypePrivate;

  return await status.send();
}