  The modular class of a regular foliation is a cohomological obstruction to
the existence of a volume form transverse to the leaves which is invariant
under the flow of the vector fields of the foliation. By drawing on the
relationship between Lie algebroids and regular foliations, this paper extends
the notion of modular class to the realm of singular foliations. The
singularities are dealt with by replacing the singular foliations by any of
their universal Lie $\infty$-algebroids, and by picking up the modular class of
the latter. The geometric meaning of the modular class of a singular foliation
$\mathcal{F}$ is not as transparent as for regular foliations: it is an
obstruction to the existence of a universal Lie $\infty$-algebroid of
$\mathcal{F}$ whose Berezinian line bundle is a trivial $\mathcal{F}$-module.
This paper illustrates the relevance of using universal Lie $\infty$-algebroids
to extend mathematical notions from regular foliations to singular ones, thus
paving the road to defining other characteristic classes in this way.
