e..g
var bikeRadar = new AntPlus.BikeRadar(null); var radarInfo = bikeRadar.getRadarInfo(); if (radarInfo != null && radarInfo.size() > 0) { var threatStr = radarInfo[0].threat.format("%d"); }
The preceding code produces the following error for the line starting with "var threatStr".
ERROR: ... Cannot find symbol ':format' on type '$.Toybox.AntPlus.ThreatLevel'.
The workaround is to use a typecast:
var threatStr = ((radarInfo[0].threat) as Number).format("%d");
But I feel like the typecast should be unnecessary, since AntPlus.ThreatLevel takes on the values 0, 1 or 2.