open abstract method

void open({
  1. Future<void> onOpened()?,
  2. dynamic onSuccess()?,
  3. Future<void> onDone(
    1. List<ServerSentEvent> sseList
    )?,
  4. Future<void> onReceive(
    1. ServerSentEvent event
    )?,
  5. dynamic onError(
    1. Object error
    )?,
  6. RequestOptions? requestOptions,
})

Open a sse stream onOpened First chunk data received will call it onSuccess Stream open success callback onDone Call back when stream transition done onReceive After receive stream data and transform to ServerSentEvent callback onError Open fail or transform process throw error callback requestOptions If stream from network request, This parameter represents its request RequestOptions But is not, it will be null.

Implementation

void open(
    {Future<void> Function()? onOpened,
    Function()? onSuccess,
    Future<void> Function(List<ServerSentEvent> sseList)? onDone,
    Future<void> Function(ServerSentEvent event)? onReceive,
    Function(Object error)? onError,
    RequestOptions? requestOptions});