instance static method

ApiServices instance([
  1. Dio? dio
])

Returns the singleton instance.

If configure was called first, the instance already has the token interceptor attached. Otherwise you get a plain Dio client.

Pass a custom dio only in tests — do not use in production code.

Implementation

static ApiServices instance([Dio? dio]) {
  _instance ??= ApiServicesImplementation.instanceFor(
    dio: dio ?? DioFactory().getDio(logOptions: _logOptions),
  );
  return _instance!;
}