shutdown method

Future<void> shutdown()

Runs the disposal phase for all registered plugins (spec 025).

Calls each plugin's ZuraffaPlugin.onDispose in reverse registration order so dependants tear down before their providers. Idempotent: a second call is a no-op, so shutdown paths can be defensive (e.g. runZonedGuarded finally blocks).

Implementation

Future<void> shutdown() async {
  if (_shutdownCompleted) return;
  _shutdownCompleted = true;

  final plugins = _plugins.values.toList();
  for (final plugin in plugins.reversed) {
    await plugin.onDispose(di);
  }
}