PocketBase constructor

PocketBase(
  1. String baseURL, {
  2. String lang = "en-US",
  3. AuthStore? authStore,
  4. bool reuseHTTPClient = false,
  5. Client httpClientFactory()?,
})

Implementation

PocketBase(
  this.baseURL, {
  this.lang = "en-US",
  AuthStore? authStore,

  /// Initializes a single HTTP client and reuses it for all requests,
  /// in order to improve the performance by keeping a persistent connection.
  ///
  /// NB! If enabled you'll need to call `pb.close()` once you are done
  /// working with the client.
  bool reuseHTTPClient = false,

  /// Optional factory to load custom `http.Client` implementation.
  http.Client Function()? httpClientFactory,
}) {
  this.authStore = authStore ?? AuthStore();
  this.httpClientFactory = httpClientFactory ?? http.Client.new;

  if (reuseHTTPClient) {
    _sharedHTTPClient = this.httpClientFactory();
  }

  collections = CollectionService(this);
  files = FileService(this);
  realtime = RealtimeService(this);
  settings = SettingsService(this);
  logs = LogService(this);
  health = HealthService(this);
  backups = BackupService(this);
  crons = CronService(this);
  sql = SQLService(this);
}