disposeId method Null safety

  1. @protected
void disposeId(
  1. String? id,
  2. String groupName
)

Remove the object with the specified id from the specified object group.

If the object exists in other groups it will remain alive and the object id will remain valid.

Implementation

@protected
void disposeId(String? id, String groupName) {
  if (id == null) {
    return;
  }

  final _InspectorReferenceData? referenceData = _idToReferenceData[id];
  if (referenceData == null) {
    throw FlutterError.fromParts(<DiagnosticsNode>[ErrorSummary('Id does not exist')]);
  }
  if (_groups[groupName]?.remove(referenceData) != true) {
    throw FlutterError.fromParts(<DiagnosticsNode>[ErrorSummary('Id is not in group')]);
  }
  _decrementReferenceCount(referenceData);
}