InfluxDBClient constructor
InfluxDBClient({})
Create a new client for a InfluxDB.
Example:
var client = InfluxDBClient(
url: 'http://localhost:8086',
token: 'my-token',
org: 'my-org',
bucket: 'my-bucket'
);
debug
- enable/disable verbose http call tracingusername
andpassword
is only for InfluxDB 1.8 compatibility
Implementation
InfluxDBClient(
{String? url,
String? token,
String? bucket,
String? org,
Client? client,
/// InfluxDB 1.x compatibility only
String? username,
/// InfluxDB 1.x compatibility only
String? password,
/// verbose logging of http calls
this.debug = defaultEnableDebug,
this.maxRedirects = defaultMaxRedirects,
this.followRedirects = defaultFollowRedirects}) {
this.url = url ?? const String.fromEnvironment('INFLUXDB_URL');
this.token = token ?? const String.fromEnvironment('INFLUXDB_TOKEN');
this.bucket = bucket ?? const String.fromEnvironment('INFLUXDB_BUCKET');
this.org = org ?? const String.fromEnvironment('INFLUXDB_ORG');
this.client = client ?? LoggingClient(debug, Client());
// 1.8 compatibility token
if (username != null && password != null && token == null) {
this.token = '$username:$password';
}
defaultHeaders['User-Agent'] = '$clientName/$clientVersion';
}