toInt static method

int toInt(
  1. dynamic value
)

Handle the value to int.

Implementation

static int toInt(dynamic value) {
  if (value is int) return value;
  if (value is double) return value.toInt();
  if (value is String) return int.parse(value.split('.')[0]);

  return 0;
}