toLongWithDefault static method

int toLongWithDefault(
  1. dynamic value,
  2. int defaultValue
)

Converts value into integer or returns default when conversion is not possible.

  • value the value to convert.
  • defaultValue the default value. Returns long value or default when conversion is not supported

See toNullableLong

Implementation

static int toLongWithDefault(value, int defaultValue) {
  var result = LongConverter.toNullableLong(value);
  return result ?? defaultValue;
}