getCurrentReferenceCount method

int getCurrentReferenceCount(
  1. String scopeId,
  2. Type type, {
  3. int index = 0,
})

Returns current reference count for type in given scope

Implementation

int getCurrentReferenceCount(String scopeId, Type type, {int index = 0}) {
  final objects = _references[scopeId]?[type];

  if (objects != null) {
    if (index < 0 || index >= objects.length) {
      throw IllegalArgumentException(
        message:
            'The $index value must be non-negative and less than count of references of $type in $scopeId.',
      );
    }

    return objects[index];
  } else {
    return 0;
  }
}