getMaxId method

int getMaxId()

Retrieves the maximum ID value for the given data.

Returns:

  • The maximum ID value found in the data, or 0 if IDs are of type String.

Implementation

int getMaxId() {
  if (TId is String) {
    return 0;
  }
  return _data.values
      .expand((routeData) => routeData.keys.whereType<int>())
      .fold(0, (max, id) => id > max ? id : max);
}