subscribe<T> method
Subscribes to the given request
and returns the stream of response events.
An optional onEstablished
callback can be used to be alerted when the
subscription has been successfully established with the server.
Any exceptions encountered during the subscription are added as errors to this stream.
Implementation
Stream<GraphQLResponse<T>> subscribe<T>(
GraphQLRequest<T> request, {
void Function()? onEstablished,
}) {
return plugins.length == 1
? plugins[0].subscribe(request, onEstablished: onEstablished)
: throw _pluginNotAddedException('Api');
}