create method

Probe? create(
  1. String type
)

Create an instance of a probe based on its data type.

This methods search this sampling package registry for a SamplingPackage which has a probe of the specified type.

Returns null if no probe is found for the specified type.

Implementation

Probe? create(String type) {
  Probe? probe;

  final packages = lookup(type);

  if (packages.isNotEmpty) {
    if (packages.length > 1) {
      warning(
          "$runtimeType - It seems like the data type '$type' is defined in more than one sampling package. "
          "Is using the probe provided in the ${packages.first} package.");
    }
    probe = packages.first.create(type);
    probe?.deviceManager = packages.first.deviceManager;
  }

  return probe;
}