validatedNativeArrayCount function

int validatedNativeArrayCount(
  1. int count,
  2. String noun
)

Validates a native-required element count before allocating the buffer.

Implementation

int validatedNativeArrayCount(int count, String noun) {
  if (count < 0) {
    throw StateError('Native $noun returned a negative count');
  }
  return count;
}