delete method

  1. @override
Future<void> delete()

Cleans up resources used by this service.

This method is called automatically when FirebaseApp.close is called on the parent app. Services should override this to release any held resources such as:

  • Network connections
  • File handles
  • Cached data
  • Subscriptions or listeners

Implementation

@override
Future<void> delete() async {
  // Close HTTP client if we created it (emulator mode)
  // In production mode, we use app.client which is closed by the app
  if (Environment.isCloudTasksEmulatorEnabled()) {
    try {
      final client = await _requestHandler.httpClient.client;
      client.close();
    } catch (_) {
      // Ignore errors if client wasn't initialized
    }
  }
}