convertFromDouble function

Object convertFromDouble(
  1. Object? original,
  2. double target
)

Converts a double target value to its corresponding type.

If the original is of type int, the double value is converted to int. If the original is of type String, the double value is converted to String. Otherwise, the original double value is returned as is.

Implementation

Object convertFromDouble(Object? original, double target) {
  if (original is int) {
    return target.toInt();
  } else if (original is String) {
    return '$target';
  } else {
    return target;
  }
}