connect static method

Future<EventSource> connect(
  1. dynamic url, {
  2. Client? client,
  3. String? lastEventId,
  4. Map<String, String>? headers,
  5. String? body,
  6. String? method,
})

Create a new EventSource by connecting to the specified url.

Implementation

static Future<EventSource> connect(url,
    {http.Client? client,
    String? lastEventId,
    Map<String, String>? headers,
    String? body,
    String? method}) async {
  // parameter initialization
  url = url is Uri ? url : Uri.parse(url);
  client = client ?? new http.Client();
  body = body ?? "";
  method = method ?? "GET";
  EventSource es = new EventSource._internal(
      url, client, lastEventId, headers, body, method);
  await es._start();
  return es;
}