directionFromDegree method

String directionFromDegree(
  1. double? degree
)
inherited

Implementation

String directionFromDegree(double? degree) {
  if (degree == null) {
    return '';
  }
  if (degree >= 0 && degree <= 20) {
    return 'north';
  } else if (degree > 20 && degree < 70) {
    return 'northeast';
  } else if (degree >= 70 && degree <= 110) {
    return 'east';
  } else if (degree > 110 && degree < 160) {
    return 'southeast';
  } else if (degree >= 160 && degree <= 200) {
    return 'south';
  } else if (degree > 200 && degree < 250) {
    return 'southwest';
  } else if (degree >= 250 && degree <= 290) {
    return 'west';
  } else if (degree > 290 && degree < 340) {
    return 'northwest';
  } else if (degree >= 340 && degree <= 360) {
    return 'north';
  } else {
    return '';
  }
}