hasPermission method

Future<bool> hasPermission(
  1. List<HealthPermission> healthPermissions
)

Implementation

Future<bool> hasPermission(List<HealthPermission> healthPermissions) async {
  final types =
      healthPermissions.map<HealthDataType>((e) => e.healthDataType).toList();
  final permissions = healthPermissions
      .map<HealthDataAccess>((e) => e.healthDataAccess)
      .toList();
  final hasPermission =
      await health.hasPermissions(types, permissions: permissions);
  return hasPermission ?? true;
}