dispose method

  1. @override
void dispose()
override

Frees all currently tracked slots and clears the slot table.

Called automatically by the owning RaylibTempBase during disposal.

Implementation

@override
void dispose() {
  if (stringSlots.isNotEmpty) {
    final nonNulls = stringSlots.where((e) => !isPointerNull(e));
    temp.debugFreeInfo('Freeing preallocated $slotCount $name slots (used ${nonNulls.length})');
    nonNulls.map(pointerToSource).forEach(freeFunc);
  }
  if (stringSlotsKeyed.isNotEmpty) {
    temp.debugFreeInfo('Freeing user-defined ${stringSlotsKeyed.length} $name slots');
  }
  if (stringSlotsPtrsKeyed.isNotEmpty) {
    temp.debugFreeInfo('Freeing user-defined ${stringSlotsPtrsKeyed.length} $name Array slots');
    stringSlotsPtrsKeyed.values.map((v) => v.$1).forEach(freePPFunc);
  }
  reset();
}