getDependencyBreakdown static method
Get a detailed breakdown of dependencies by category Useful for understanding what's in your scope
Implementation
static Map<String, dynamic> getDependencyBreakdown(ZenScope scope) {
if (scope.isDisposed) {
return {'error': 'Scope is disposed'};
}
final controllers = <String>[];
final services = <String>[];
final others = <String>[];
final dependencies = scope.getAllDependencies();
// Categorize dependencies
for (final instance in dependencies) {
final typeName = instance.runtimeType.toString();
if (instance is ZenController) {
controllers.add(typeName);
} else if (typeName.toLowerCase().contains('service')) {
services.add(typeName);
} else {
others.add(typeName);
}
}
return {
'controllers': controllers,
'services': services,
'others': others,
'summary': {
'totalControllers': controllers.length,
'totalServices': services.length,
'totalOthers': others.length,
'grandTotal': controllers.length + services.length + others.length,
}
};
}