accountSubscribe method

Stream<Account> accountSubscribe(
  1. String address, {
  2. Commitment? commitment,
  3. Encoding encoding = Encoding.jsonParsed,
})

Subscribe to an account with address to receive notifications when the lamports or data for a given account public key changes.

Returns a Stream that can be used to listen for events. By cancelling the subscription returned by the Stream.listen() method of this stream client will automatically send accountUnsubscribe message;

For commitment parameter description see this document.

Commitment.processed is not supported as commitment.

Implementation

Stream<Account> accountSubscribe(
  String address, {
  Commitment? commitment,
  Encoding encoding = Encoding.jsonParsed,
}) =>
    _subscribe<Account>(
      'account',
      params: <dynamic>[
        address,
        <String, String>{
          if (commitment != null) 'commitment': commitment.value,
          'encoding': encoding.value,
        },
      ],
    );