Error: Dart library 'dart:js_interop' is not available on this platform
Asked Answered
A

4

6

Can anyone help me I don't know what happened I was just pubUpgrade and it become like this

I've tried flutter clean and tried to delete dart:js line in js.dart but still not work thanks for your help if someone could help me I'll be grateful.

Alack answered 20/9, 2023 at 6:47 Comment(4)
search your files for import 'dart:js_interop` and delete it, sometimes IDE imports it.Redbug
Please copy the error in text format instead of a image.Morice
after a while when I try to remove 'dart:js_interop' line again it work fine. thank youAlack
I noticed it happening when I opened my flutter project on a Windows 10 machine in vscode. I usually develop on my iMac.Ineffective
A
6

Method 1:- Try to remove imports of 'dart:js_interop' as it may be imported by default in many of your project files.

Method 2:- NOTE that this import are certainly due to usage of StreamBuilder in your app , so try to use any alternative widgets to do the same work inorder to solve your problem if NOT solved by first method. .

Appalachia answered 13/3 at 6:14 Comment(1)
Honestly, bless this site sometimes... I also had to remove 'darts_interop', as it had gotten randomly added to my main file (and was unused). I have no idea how it got there because I definelty did NOT include that. Saved me so much head ache because the error message is aggressive.Petiolate
M
0

This error may be related to the emulator you are using, you can try to run your application in the web version, if it works, I recommend you check your emulator.

Monochloride answered 24/12, 2023 at 10:16 Comment(1)
thank you. it's fixed after I delete the 'dart:js' line in the file that I'm working onAlack
S
0

For me it was NSZombieEnabled in the Environment Variable under iOS/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme which was disabled

<EnvironmentVariables>
         <EnvironmentVariable
            key = "NSZombieEnabled"
            value = "YES" //<-- Change from "NO" to "YES"
            isEnabled = "YES"> //<-- Change from "NO" to "YES"
         </EnvironmentVariable>
      </EnvironmentVariables>
Seersucker answered 19/5 at 9:16 Comment(0)
S
0

Hey I know this is an old question but I just wanted to add what worked for me: I removed all the dart:js_interop imports, which didn't work (in my case). Turns out the fact that I had a web test running at the same time as building was the issue. Stopping it made the building work. The web build.

Scalene answered 9/7 at 8:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.