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.
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
2
Answers
The update 0.4.0 of
web
has already addressed the issues shown in the error. From the changelog:For example, the class definition for
ReadableStream
in 0.3.0 was:It is now has changed to:
The
http
package depends on theweb
package. In the version 1.2.0 ofhttp
, it depends onweb
with this version constraint:To fix the issue, simply depends the
web
package directly in your pubscpec. It is safe to use version 0.4.0 and above since it still meet the constraints shown above.In your pubspec file:
Now another problem arises, the
flutter_test
package may not be compatible with these changes. If you’re not usingflutter_test
, you can simply remove it from thedev_dependencies
. If you’re using it, you can try upgrading the Flutter SDK to the version that hasflutter_test
supportsweb
≥ 0.4.0.I was able to get pass this issue. Here’s my steps:
Switch to beta channel
Upgrade SDK
Upgrade dependencies
Deploy to vercel and issue should go away
Looking forward on
web: ^0.4.2
support in #flutter stable channelThanks @Dhafin Rayhan
Hope it helps