fromServices static method
Extracts API definitions from multiple Retrofit services.
services - A map of service instances with their base URLs
Example:
final definitions = await RetrofitInspector.fromServices({
UserService(dio): 'https://api.example.com',
PostService(dio): 'https://blog.example.com',
});
Implementation
static Future<List<ApiDefinition>> fromServices(
Map<dynamic, String> services,
) async {
final definitions = <ApiDefinition>[];
for (final entry in services.entries) {
final service = entry.key;
final baseUrl = entry.value;
final definition = await fromService(
service,
baseUrl: baseUrl,
);
if (definition != null) {
definitions.add(definition);
}
}
return definitions;
}