fromString static method

OsrmResponseCode fromString(
  1. String code
)

fromString method to get the OsrmResponseCode from a string

Implementation

static OsrmResponseCode fromString(String code) {
  switch (code) {
    case 'Ok':
      return OsrmResponseCode.ok;
    case 'InvalidUrl':
      return OsrmResponseCode.invalidUrl;
    case 'InvalidService':
      return OsrmResponseCode.invalidService;
    case 'InvalidVersion':
      return OsrmResponseCode.invalidVersion;
    case 'InvalidOptions':
      return OsrmResponseCode.invalidOptions;
    case 'InvalidQuery':
      return OsrmResponseCode.invalidQuery;
    case 'InvalidValue':
      return OsrmResponseCode.invalidValue;
    case 'NoSegment':
      return OsrmResponseCode.noSegment;
    case 'TooBig':
      return OsrmResponseCode.tooBig;
    default:
      throw Exception('Invalid response code: $code');
  }
}