PostgrestClient constructor

PostgrestClient(
  1. String url, {
  2. Map<String, String>? headers,
  3. String? schema,
  4. Client? httpClient,
  5. YAJsonIsolate? isolate,
})

To create a PostgrestClient, you need to provide an url endpoint.

You can also provide custom headers and _schema if needed

PostgrestClient(REST_URL)
PostgrestClient(REST_URL, headers: {'apikey': 'foo'})

httpClient is optional and can be used to provide a custom http client

isolate is optional and can be used to provide a custom isolate, which is used for heavy json computation

Implementation

PostgrestClient(
  this.url, {
  Map<String, String>? headers,
  String? schema,
  this.httpClient,
  YAJsonIsolate? isolate,
})  : _schema = schema,
      headers = {...defaultHeaders, if (headers != null) ...headers},
      _isolate = isolate ?? (YAJsonIsolate()..initialize()),
      _hasCustomIsolate = isolate != null;