toInt function

int toInt(
  1. dynamic value, {
  2. int fallback = 0,
})

Convert any dynamic value to int or fallback safely.

Implementation

int toInt(value, {int fallback = 0}) {
  return toIntOrNull(value) ?? fallback;
}