onConfigure method

  1. @override
void onConfigure()
override

Callback on configure.

When called, the configuration and the registration is available.

Is to be overridden in sub-classes. Note, however, that it must not be doing a lot of work on startup.

Implementation

@override
void onConfigure() {
  // listen to the battery
  _battery.onBatteryStateChanged.listen(
    (state) async => _batteryLevel = await _battery.batteryLevel,
  );

  // find the supported data types
  for (var package in SamplingPackageRegistry().packages) {
    if (package is SmartphoneSamplingPackage) {
      _supportedDataTypes.addAll(
        package.dataTypes.map((type) => DataType.fromString(type.type)),
      );
    }
  }
}