OpenToolClient constructor
OpenToolClient({})
Implementation
OpenToolClient({
bool? isSSL,
required String toolHost,
required int toolPort,
this.toolApiKey,
}) {
if (isSSL != null) this.isSSL = isSSL;
if (toolHost.isNotEmpty) this.host = toolHost;
if (toolPort > 0) this.port = toolPort;
String protocol = this.isSSL ? 'https' : 'http';
String baseUrl = '$protocol://${this.host}:${this.port}${this.prefix}';
Map<String, String> headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
if (toolApiKey != null && toolApiKey!.isNotEmpty)
'Authorization': 'Bearer $toolApiKey',
};
dio = Dio(BaseOptions(baseUrl: baseUrl, headers: headers));
}