create method
Creates a new Probe for the data type.
Asks the first registered package that supports type to create the
probe, and sets the probe's Probe.deviceManager to the package's device
manager. If more than one package supports type, a warning is logged.
Returns null if no probe is found for type, e.g., when the probe is
not available on this OS or its package is not registered.
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;
}