\stretch{someFactor} is a generalization of the rubber-space command \hfill in the sense that \hfill is the special case \stretch{1.0}. (I'm actually more interested in the starred version \hspace*{\fill} rather than \hspace{\fill} version because I want to be able to force a space at the end of a line.)
\dotfill is an analog of \hfill in the sense that \dotfill fills with spaced dots the same horizontal space that \hfill would fill with empty space.
I would like to define a \stretchDotfill{someFactor} command that fills with spaced dots the same space that \stretch{someFactor} would fill with empty space.
Note that my question is not the same as "How to change dot spacing in \dotfill?." Changing the dot spacing does not affect the length of the space that \dotfill fills; it only changes the density of the dots within the same length of horizontal space.
I understand that the definition of \dotfill is:
\leavevmode \cleaders \hb@xt@ .44em{\hss .\hss }\hfill \kern \z@
I used \meaning\stretch and got, approximately:
macro:#1-¿\z@ \@plus #1fill\relax
(I'm using Overleaf and I don't fully trust the characters it gave me. E.g., it gave me “ instead of \. I fixed those but I'm not sure about the ¿.)
However, I don't know how to proceed further.
[Why do I want to do this? I'm writing a title-page banner builder, where there are discrete horizontal boxes within a row, and the person building the banner can use \stretch to fine tune the spacing between adjacent boxes (or between a box on one end and the nearer margin). I'd like a "debug mode" to make the \stretch space visible. I thought I'd do that with \dotfill if I can generalize \dotfill to accept a stretch factor. (If I were using only \hfill to control the spacing, I would use \dotfill for the debug mode.)]

\texttt(or T1 encoding) if you use verbatim codes in roman OT1 encoding you see the ¿ and other artefacts of that encoding, – David Carlisle Dec 19 '18 at 17:09