WordPress Theme Check error: file_get_contents found – how to fix with WP_Filesystem?

I’m using the PHP file_get_contents() function to retrieve and echo the contents of an SVG-file.

echo file_get_contents($icon_url);

I’m using the PHP file_get_contents() function to retrieve and echo the contents of an SVG-file.

I checked the theme with the WordPress.org theme checker and I am currently resolving all the issues. One of the issues is the use of file_get_contents.

file_get_contents was found in the file template-parts/sample.php File
operations should use the WP_Filesystem methods instead of direct PHP
filesystem calls.

Answers are appreciated to me, thanks for the help