In Dart, is it possible to have a const map of closures?
<p>I created a literal map of closures, something like:</p>

<pre><code>Map&lt;String, Function&gt; mapOfFuncs = {
  'foo': (a, b, c) =&gt; ... ,
  'bar': (a, b, c) =&gt; ... ,
   ...
}
</code></pre>

<p>All good so far. Then I wanted to make this map <code>const</code>, as it is global within my program and should never be modified.</p>

<pre><code>const Map&lt;String, Function&gt; MAP_OF_FUNCS = const {
  'foo': (a, b, c) =&gt; ... ,
  'bar': (a, b, c) =&gt; ... ,
   ...
}
</code></pre>

<p>Dart chokes on this as the literal closures in the map are not <code>const</code>.</p>

<p>On Dartpad: <a href="https://dartpad.dartlang.org/817d2cfd141b0a56fc7d" rel="noreferrer">https://dartpad.dartlang.org/817d2cfd141b0a56fc7d</a></p>

<p>I would have thought that literal closures are <code>const</code>. Is there a way to make them so?</p>