getMeasurement method

  1. @override
Future<Measurement?> getMeasurement()
override

Subclasses should implement this method to collect a Measurement.

Can return null if no data is available. Can return an Error measurement if an error occurs.

Implementation

@override
Future<Measurement?> getMeasurement() async {
  await DeviceInfoService().init();

  return Measurement.fromData(
    DeviceInformation(
      deviceData: DeviceInfoService().deviceData,
      platform: DeviceInfoService().platform,
      deviceId: DeviceInfoService().deviceID,
      deviceName: DeviceInfoService().deviceName,
      deviceModel: DeviceInfoService().deviceModel,
      deviceManufacturer: DeviceInfoService().deviceManufacturer,
      operatingSystem: DeviceInfoService().operatingSystemName,
      hardware: DeviceInfoService().hardware,
    ),
  );
}