from static method

OsrmAlternative from(
  1. dynamic alternative
)

from method to get the OsrmAlternative from a dynamic value

Implementation

static OsrmAlternative from(dynamic alternative) {
  if (alternative is bool) {
    return alternative ? OsrmAlternative.true_ : OsrmAlternative.false_;
  } else if (alternative is num) {
    return OsrmAlternative.number(alternative.toInt());
  } else {
    throw ArgumentError('Invalid alternative: $alternative');
  }
}