asInts method

int asInts(
  1. List<String> keys
)

Implementation

int asInts(List<String> keys) {
  for (final String key in keys) {
    final value = this[key];
    if (value == null) {
      return 0;
    }
    if (value is int) {
      return value;
    }
    try {
      String value0 = value.toString();
      if (value0.isEmpty) {
        return 0;
      }
      final int result = int.parse(value0.toString());
      return result;
    } catch (e) {
      _print('json 解析异常,异常值,期望int值:"$key":$value');
    }
  }
  return 0;
}