# getItem method

Future <Result<PubSubError, PubSubItem>> getItem(

1. JID jid,
2. String node,
3. String id

)

## Implementation

    Future<Result<PubSubError, PubSubItem>> getItem(
      JID jid,
      String node,
      String id,
    ) async {
      final result = (await getAttributes().sendStanza(
        StanzaDetails(
          Stanza.iq(
            type: 'get',
            to: jid.toString(),
            children: [
              XMLNode.xmlns(
                tag: 'pubsub',
                xmlns: pubsubXmlns,
                children: [
                  XMLNode(
                    tag: 'items',
                    attributes: <String, String>{'node': node},
                    children: [
                      XMLNode(
                        tag: 'item',
                        attributes: <String, String>{'id': id},
                      ),
                    ],
                  ),
                ],
              ),
            ],
          ),
          shouldEncrypt: false,
        ),
      ))!;

      if (result.attributes['type'] != 'result') {
        return Result(getPubSubError(result));
      }

      final pubsub = result.firstTag('pubsub', xmlns: pubsubXmlns);
      if (pubsub == null) return Result(getPubSubError(result));

      final itemElement = pubsub.firstTag('items')?.firstTag('item');
      if (itemElement == null) return Result(NoItemReturnedError());

      final item = PubSubItem(
        id: itemElement.attributes['id']! as String,
        payload: itemElement.children[0],
        node: node,
      );

      return Result(item);
    }