toListOfInt static method

List<int> toListOfInt(
  1. dynamic d
)

Converts a dynamic value to a non-nullable list of integers.

d - The dynamic value to be converted. Returns a list of integers.

Implementation

static List<int> toListOfInt(dynamic d) {
  final jsonList = Convert.toListN(d);
  final List<int> result = [];
  if (jsonList != null) {
    jsonList.forEach((e) {
      final i = Convert.toIntN(e);
      if (i != null) {
        result.add(i);
      }
    });
  }
  return result;
}