I get the following error when i build my project in flutter

Viewed 621

C:\Users\Faheem\Desktop\dashboard>flutter build apk --profile

Building with sound null safety

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart:2:8: Error: Not found: 'dart:html' import 'dart:html'; ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.6.2/lib/firebase_core_web.dart:9:8: Error: Not found: 'dart:html' import 'dart:html'; ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_web-3.3.13/lib/src/firebase_auth_web_recaptcha_verifier_factory.dart:7:8: Error: Not found: 'dart:html' import 'dart:html'; ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:2:8: Error: Not found: 'dart:html' import 'dart:html'; ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.6.2/lib/firebase_core_web.dart:10:8: Error: Not found: 'dart:js' import 'dart:js'; ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3/lib/js.dart:8:1: Error: Not found: 'dart:js' export 'dart:js' show allowInterop, allowInteropCaptureThis; ^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:13:8: Error: Not found: 'dart:html' import 'dart:html' as html; ^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:6:8: Error: Not found: 'dart:html' import 'dart:html' as html; ^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:5:8: Error: Not found: 'dart:html'
import 'dart:html'; ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util' export 'dart:js_util'; ^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:79:48: Error: Type 'html.EventListener' not found. external ui.VoidCallback addPopStateListener(html.EventListener fn); ^^^^^^^^^^^^^^^^^^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:194:3: Error: Type 'html.Location' not found. html.Location get _location => html.window.location; ^^^^^^^^^^^^^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:196:3: Error: Type 'html.History' not found. html.History get _history => html.window.history; ^^^^^^^^^^^^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:199:28: Error: Type 'html.EventListener' not found. void addPopStateListener(html.EventListener fn) { ^^^^^^^^^^^^^^^^^^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:204:31: Error: Type 'html.EventListener' not found. void removePopStateListener(html.EventListener fn) { ^^^^^^^^^^^^^^^^^^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:7:7: Error: Type 'AnchorElement' not found. final AnchorElement _urlParsingNode = AnchorElement(); ^^^^^^^^^^^^^ /C:/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:20:7: Error: Type 'Element' not found. final Element? _baseElement = document.querySelector('base'); ^^^^^^^ ../../runtime/vm/zone.cc: 94: error: Out of memory. version=2.16.2 (stable) (Tue Mar 22 13:15:13 2022 +0100) on "windows_x64" pid=3640, thread=8308, isolate_group=main(00000000053F0BE0), isolate=(nil)(0000000000000000) isolate_instructions=3e90000, vm_instructions=7ff6304d5460

pc 0x00007ff6306dd222 fp 0x000000000a36eb20 Dart_IsPrecompiledRuntime+0x21cd22 -- End of DumpStackTrace === Crash occured when compiling package:front_end/src/fasta/kernel/hierarchy/hierarchy_node.dart_ClassHierarc* What went wrong: Execution failed for task ':app:compileFlutterBuildProfile'.

Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

1 Answers

Try these commands:

flutter clean
flutter packages get
dart pub get

If this doesn't solve your problem, I recommend starting a new project and moving your code and pubspec.yaml files there.

Related