# registerDestructionCallback method

void registerDestructionCallback(

1. String name,
2. Runnable callback

)

Register a callback to be executed on destruction of the specified object in the scope (or at destruction of the entire scope, if the scope does not destroy individual objects but rather only terminates in its entirety).

Destruction callbacks are essential for proper resource cleanup and are typically used for:

- Closing database connections
- Releasing file handles
- Stopping background threads
- Cleaning up temporary resources

`name`: The name of the object to associate the callback with `callback`: The callback to execute when the object is destroyed or when the scope terminates

Throws:

- IllegalArgumentException if name is null or empty, or callback is null
- UnsupportedOperationException if the scope doesn't support destruction callbacks

Example:

    final databaseConnection = DatabaseConnection();
    scope.registerDestructionCallback('databaseConnection', () {
      databaseConnection.close();
      print('Database connection closed');
    });

    // Later, when scope is destroyed or object is removed:
    // The callback will be executed automatically

## Implementation

    void registerDestructionCallback(String name, Runnable callback) {}