install function

void install({
  1. bool? cacheCleanOnStartUp,
  2. Duration? cacheStalePeriod,
  3. int? cacheMaxNrOfObjects,
  4. bool? debug,
  5. String domain = '',
  6. double? maxDpr,
  7. String? path,
  8. int? step,
  9. Duration? visibilityUpdateInterval,
})

Implementation

void install({
  bool? cacheCleanOnStartUp,
  Duration? cacheStalePeriod,
  int? cacheMaxNrOfObjects,
  bool? debug,
  String domain = '',
  double? maxDpr,
  String? path,
  int? step,
  Duration? visibilityUpdateInterval,
}) {
  if (rValidDomain.hasMatch(domain)) {
    config.domain = domain;
  } else {
    throw ArgumentError('install domain "$domain" is invalid');
  }
  if (path != null && rInvalidPath.hasMatch(path)) {
    throw ArgumentError('install path "$path" is invalid');
  }
  config.domain = rValidDomain.firstMatch(domain)!.group(1)!;
  config.path = config.path =
      path != null ? '${rValidPath.firstMatch(path)!.group(1)!}/' : '';

  if (cacheCleanOnStartUp != null) {
    config.cacheCleanOnStartUp = cacheCleanOnStartUp;
  }
  if (cacheStalePeriod != null) {
    config.cacheStalePeriod = cacheStalePeriod;
  }
  if (cacheMaxNrOfObjects != null) {
    config.cacheMaxNrOfObjects = cacheMaxNrOfObjects;
  }
  if (debug != null) {
    config.debug = debug;
  }
  if (maxDpr != null) {
    config.maxDpr = maxDpr;
  }
  if (step != null) {
    config.step = step;
  }
  VisibilityDetectorController.instance.updateInterval =
      visibilityUpdateInterval ?? const Duration(milliseconds: 50);
}