getDialog method

Future<ChatMixin?> getDialog(
  1. UserId userId
)

Returns the dialog Chat of the authenticated MyUser with a User identified by the provided userId.

Implementation

Future<ChatMixin?> getDialog(UserId userId) async {
  Log.debug('getDialog($userId)', '$runtimeType');

  if (client.token == null) {
    return null;
  }

  final variables = GetDialogArguments(id: userId);
  final QueryResult result = await client.query(
    QueryOptions(
      operationName: 'GetDialog',
      document: GetDialogQuery(variables: variables).document,
      variables: variables.toJson(),
    ),
  );
  return GetDialog$Query.fromJson(result.data!).user?.dialog;
}