Open Imgkl opened 9 months ago
The fetch_api package is intended for web use, which would explain why it's relying on dart:js
. However, this becomes an issue when you try to run your Flutter app on platforms other than the web because the package is not compatible with non-web environments. Just by importing it in the package, seems to cause issue.
Possible Solutions:
eventflux_client_manager
and do conditional imports based on platform
Dio
in favour of http
Any updates on this issue ? It's very important to start using EventFlux. Thank you
Hi, I'm fetch_client
author.
Was checking usage of package and stumbled upon this issue. We've fixed it in last version, so you can now import client in VM (it will throw UnsupportedError
is you try to instantiate it).
As a side note, when you use web only package (which uses js_interop
or dart:html
) you should do conditional import like in this example from package:http
: https://github.com/dart-lang/http/blob/dd31e64685b03a9700cc99d7b7fc637dd60c4d3a/pkgs/flutter_http_example/lib/main.dart#L13-L14
Hope this will help to resolve this!
References