socket/socket_io_adapter library

Classes

SocketInterceptor
SocketInterceptor is an abstract class that can be used to intercept requests and responses to and from the server. It contains the onRequest, onResponse, and onError methods. The onRequest method is called before the request is sent to the server. The onResponse method is called after the response is received from the server. The onError method is called when an error occurs.
SocketIOAdapter
SocketIOAdapter is a class that wraps the socket.io client. It provides a simple interface to connect, disconnect, emit events and listen to events. It also provides a way to intercept requests and responses. The options is the options for the socket. The interceptors is a list of SocketInterceptors to intercept requests and responses. The checkResponse is a function that checks if the response from the server is valid. It takes a dynamic data as an argument and returns a boolean. By default, it checks if the status.ok field is true.
SocketIOOptions
SocketIOOptions is the options for the socket. It contains the path, transports, headers, and timeout. The path is the path to the server. The transports are the transports to be used. The headers are the headers to be sent to the server. The timeout is the timeout for the socket.
SocketRequest
SocketRequest is the request to the server. It contains the event and the data to be sent to the server. The data is a map of key-value pairs.
SocketResponse
SocketResponse is the response from the server. It contains the data returned from the server. The data is a map of key-value pairs.

Typedefs

EventCallback = Map<String, dynamic Function(dynamic data)>
EventCallback is a map of event names and their respective callback functions. The callback function takes a dynamic data as an argument.

Exceptions / Errors

SocketException
SocketException is an exception that is thrown when an error occurs. It contains the response from the server and the stackTrace of the error. The response is the response from the server. The stackTrace is the stack trace of the error.