Insert a fullpage landscape figure without having to manually cut text

I have a document with a lot of text and I want a fullpage landscape figure to be inserted somewhere in the middle. I have two options:

• Use a normal figure and rotate it, but this makes it annoying to read the PDF

• Use \begin{landscape} and \end{lanscape} but then I have to "cut" the text by placing those myself.

Is there some way to have the landscape page behave as a figure and automagically insert itself somewhere instead of starting a new page when I write \begin{landscape} and ending it when I write \end{lanscape}?

I tried putting \begin{landscape} and \end{lanscape} inside a figure but it didn't work.

Maybe you can use package afterpage.

Example:

\documentclass{article}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{lipsum}% dummy text
\begin{document}
\lipsum[1]
\afterpage{%
\begin{landscape}
\begin{figure}%
\rule{\linewidth}{\textheight}%
\end{figure}
\end{landscape}%
}
\lipsum
\end{document}