FanetClient constructor

FanetClient({
  1. required String baseUrl,
  2. Client? client,
})

Creates a client against baseUrl (the server origin, e.g. https://network.fa1.dev; a trailing slash is tolerated).

When client is omitted a default package:http client is created and owned by this instance; close closes only an owned client.

Implementation

FanetClient({required String baseUrl, http.Client? client})
  : baseUrl = baseUrl.endsWith('/')
        ? baseUrl.substring(0, baseUrl.length - 1)
        : baseUrl,
    _client = client ?? http.Client(),
    _ownsClient = client == null;