>>> List _generateUsedComponentReferences( Globals globals, FormComponent component) { return component.children == null ? [] : component.children.map>((c) { final globalComponent = globals.components.firstWhere( (c) => c.id == component.component.componentId, orElse: () => null); < dynamic>[ reference(globalComponent.className, globalComponent.importPath) ]..addAll(_generateUsedComponentReferences(globals, c)); }).toList(); } <<< List _generateUsedComponentReferences( Globals globals, FormComponent component, ) { return component.children == null ? [] : component.children.map>((c) { final globalComponent = globals.components.firstWhere( (c) => c.id == component.component.componentId, orElse: () => null, ); [ reference(globalComponent.className, globalComponent.importPath), ]..addAll(_generateUsedComponentReferences(globals, c)); }).toList(); }