title: How to assign a function inline to a value in Dart?
body: <p>I like to assign the return value of a function to a variable, but inline. The following is how you would do it not inline.</p>
  
  <pre><code>bool isValid() {
      if(a == b) return true;
      if(a == c) return true;
      return false;
  }
  
  bool result = isValid();
  </code></pre>
  
  <p>What I want is something like</p>
  
  <pre><code>bool result = () {
      if(a == b) return true;
      if(a == c) return true;
      return false;
  }
  </code></pre>
  
  <p>However it displays the error </p>
  
  <blockquote>
    <p>The argument type 'Null Function()' can't be assigned to the parameter type 'bool'</p>
  </blockquote>
  
  <p>How do I achieve this?</p>