title: When i try to build flutter web version it shows an error
body: <p>When I try to build a web version for any project it shows this error</p>
  <pre><code>Target dart2js failed: Exception: 
  Compiling lib\main.dart for the Web...                             30.0s
  Exception: Failed to compile application for the Web.
  </code></pre>
  <p>even the default project gives the same error, but when I try to start debugging it works fine.</p>
  <p>another problem is that when I build the apk version it shows this error but it builds the apk successfully.</p>
  <pre><code>Building with sound null safety
  Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
  Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
  Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
  Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
  Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
  Running Gradle task 'assembleRelease'...                          110.7s
  √  Built build\app\outputs\flutter-apk\app-release.apk (15.5MB).
  </code></pre>
  <p>I tried to redownload the flutter SDK but didn't work.</p>
  <p>my <code>flutter doctor -v</code> result</p>
  <pre><code>    [√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19042.1415], locale en-US)
      • Flutter version 2.8.1 at C:\Users\abduu\Flutter
      • Upstream repository https://github.com/flutter/flutter.git
      • Framework revision 77d935af4d (3 weeks ago), 2021-12-16 08:37:33 -0800
      • Engine revision 890a5fca2e
      • Dart version 2.15.1
  
  [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
      • Android SDK at C:\Users\abduu\AppData\Local\Android\sdk
      • Platform android-31, build-tools 31.0.0
      • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java      
      • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
      • All Android licenses accepted.
  
  [√] Chrome - develop for the web
      • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
  
  [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.0)
      • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
      • Visual Studio Community 2019 version 16.11.31605.320
      • Windows 10 SDK version 10.0.19041.0
  
  [√] Android Studio (version 2020.3)
      • Android Studio at C:\Program Files\Android\Android Studio
      • Flutter plugin can be installed from:
         https://plugins.jetbrains.com/plugin/9212-flutter
      • Dart plugin can be installed from:
         https://plugins.jetbrains.com/plugin/6351-dart
      • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
  
  [√] VS Code (version 1.63.2)
      • VS Code at C:\Users\abduu\AppData\Local\Programs\Microsoft VS Code
      • Flutter extension version 3.28.0
  
  [√] Connected device (3 available)
      • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.1415]
      • Chrome (web)      • chrome  • web-javascript • Google Chrome 96.0.4664.110
      • Edge (web)        • edge    • web-javascript • Microsoft Edge 96.0.1054.62
  
  • No issues found!
  </code></pre>
  <p>What I have tried to do</p>
  <ul>
  <li>flutter clean</li>
  <li>flutter upgrade</li>
  <li>redownloading flutter SDK</li>
  </ul>