integerValue property

int integerValue

Returns a int or 0 if rawValue is not a int

Implementation

int get integerValue {
  if (_rawValue is int) {
    return _rawValue as int;
  } else if (_rawValue is bool) {
    return _rawValue as bool ? 1 : 0;
  } else if (_rawValue is double) {
    return (_rawValue as double).toInt();
  } else if (_rawValue is String) {
    try {
      return int.parse(_rawValue as String);
    } catch (error) {
      return 0;
    }
  }

  return 0;
}