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 {
  String? ssid = await NetworkInfo().getWifiName();
  String? bssid = await NetworkInfo().getWifiBSSID();
  String? ip = await NetworkInfo().getWifiIP();

  return Measurement.fromData(Wifi(ssid: ssid, bssid: bssid, ip: ip));
}