getData static method

Future<Map<String, dynamic>?> getData()

returns the current ServiceData object from foreground-service

Implementation

static Future<Map<String, dynamic>?> getData() async {
  String? stringData = await channel.invokeMethod<String?>(_GET_SERVICE_DATA);
  if (stringData == null) return null;
  if (stringData.toLowerCase() == 'null') return null;
  Map<String, dynamic> json = jsonDecode(stringData);
  return json;
}