title: Flutter functions Null safety errors
body: <p>Got the following errors and don't know how to update the code to solve it.</p>
  <p>Error: Can't use an expression of type 'Function?' as a function because it's potentially null.</p>
  <ul>
  <li>'Function' is from 'dart:core'.
  Try calling using ?.call instead.
  PageName nextPage = pageName_pageFunction_mapPageName.welcomePage;
  PageName nextPage2 = pageName_pageFunction_mapnextPage;</li>
  </ul>
  <p>The code:</p>
  <pre><code>enum PageName {
    welcomePage,
    register,
    login,
    editProfile,
    showProfile,
    resetPassword,
    errorUserExists,
  }
  
  Map&lt;PageName, Function&gt; pageName_pageFunction_map = {
    PageName.welcomePage: showWelcomePage,
    PageName.register: showRegisterPage,
    PageName.login: showLoginPage,
    PageName.editProfile: showEditProfile,
    PageName.showProfile: showUserProfile,
    PageName.resetPassword: showResetPassword,
    PageName.errorUserExists: showErrorUserExists,
  };
  
  void main() {
      PageName nextPage = pageName_pageFunction_map[PageName.welcomePage]();
      if (nextPage != null) {
        while (true) {
          PageName nextPage2 = pageName_pageFunction_map[nextPage]();
          if (nextPage2 != null) {
            nextPage = nextPage2;
          }
        }
      }
  }
  </code></pre>
  <p>Can you help me? Thank you</p>