title: Get subfunctions / calltree of a function in Dart
body: <p>I have an idea for a new package however I need to inject code into a given function to be able to implement it. Is it possible to get subfunctions of a function variable?</p>
  <p>Since the <a href="https://flutter.dev/docs/development/tools/devtools/overview" rel="nofollow noreferrer">Flutter DevTools</a> have a similar feature it may be possible on runtime.</p>
  <p>The code below shows a basic implementation for a better illustration of the problem.</p>
  <pre><code>void main() {
    viewCallTree(() {
      print(&quot;a&quot;);
      print(&quot;b&quot;);
      print(&quot;c&quot;);
    });
  }
  
  void viewCallTree(Function func) {
    //List&lt;function&gt; callTree = func.getCallTree();
    //converts func to List of sub-functions. Should return [function, function, function]
    //callTree[0](); -&gt; print(&quot;a);
  }
  
  </code></pre>