How do I fix: "Error: Dart library 'dart:html' is not available on this platform." in ios/android development Flutter?

6.1k Views Asked by At

Was testing a UI change on my android emulator with Flutter. Emulator crashed and I got this message:

"Error: Dart library 'dart:html' is not available on this platform. lib/…/pages/sign_up.dart:1 import 'dart:html';"

I also got this message:

FAILURE: Build failed with an exception.

  • Where: Script '/Users/calyxwozniak/dev/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1151

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/Users/calyxwozniak/dev/flutter/bin/flutter'' finished with non-zero exit value 1

build.gradle says there is an error in my flutterRoot

def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")

Upon looking at others similar questions I have tried: -flutter clean -flutter pub cache repair -flutter pub outdated -deleted and recreated the pubspec.lock folder -updated dependencies Path version -changing minsdkversion in gradle local properties

None of this resolves the error or allows me to run the emulator without it crashing immediately.

0

There are 0 best solutions below