Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Error: The type 'JSObject' can't be used as supertype." while deploying flutter app to vercel

Getting Error: The type 'JSObject' can't be used as supertype. error but I havent used dart.js anywhere in my code and unable to deploy my app to vercel.

enter image description here

below is my pubspec:

name: appname
description: "A new Flutter project."
publish_to: 'none'
version: 0.1.0

environment:
  sdk: '>=3.2.5 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  get: ^4.6.6
  font_awesome_flutter: ^10.6.0
  http: ^1.2.0
  flutter_dotenv: ^5.1.0
  

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

assets:
  - .env
like image 401
Sanket Kankariya Avatar asked Dec 11 '25 04:12

Sanket Kankariya


2 Answers

I had this same issue, not sure what packages caused the issue, but running a

flutter pub upgrade

moved quite a few packages forward for my project and fixed the issue.

I suspect the package makers I rely on have updated their transitive dependencies. Give that a try before doing any dependency overrides.

If it is still causing an issue, you can force transitive depencies forward with:

dependency_overrides:
  web: ^0.4.0

This was on the stable Flutter channel, no need to swap to beta

like image 163
NateOnGuitar Avatar answered Dec 12 '25 18:12

NateOnGuitar


For me, it was as simple as running

flutter pub add web:^0.5.0

My web dependency was stuck at 0.3.0 as a transitive dependency. The above command updates it to the latest version by turning it into a direct dependency.

like image 33
enzo Avatar answered Dec 12 '25 18:12

enzo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!