getClient static method

ServiceApi getClient()

Implementation

static ServiceApi getClient() {
  if (_instace != null) return _instace!;
  if (ParticleInfo.projectId.isEmpty || ParticleInfo.clientKey.isEmpty) {
    throw Exception("projectId or clientKey must be not empty!!! Click here to get: https://dashboard.particle.network/");
  }
  final dio = Dio();
  dio.options.headers["Content-Type"] = "application/json";
  dio.options.headers["Authorization"] = authenticate(ParticleInfo.projectId, ParticleInfo.clientKey);
  _instace = ServiceApi(dio);
  return _instace!;
}