castFn method

int castFn(
  1. dynamic v
)
override

convierte un valor dado al tipo definido para objeto

Implementation

int castFn(v) {
  if (v == null) return 0;
  if (v is int) {
    return v;
  } else if (v is double) {
    return v.toInt();
  } else if (v is String) {
    return int.tryParse(v) ?? 0;
  }
  throw 'IntData:CastFn: Imposible convertir a int desde ${v.runtimeType.toString()}';
}