hasHealthPermissions method
Check if the service has permissions to access the list of health types
.
This method is called by the HealthProbe when it needs to access health
data and is a more specific method than hasPermissions
.
Note that this method always return false on iOS, as there is no way to know if permissions are granted.
Implementation
Future<bool> hasHealthPermissions(List<HealthDataType> types) async {
if (types.isEmpty) return true;
info(
'$runtimeType - Checking permissions for health types: $types on ${Platform.operatingSystem}');
try {
return await service?.hasPermissions(types) ?? false;
} catch (error) {
warning('$runtimeType - Error getting permission status - $error');
}
return false;
}