Call package only when run in flutter web

Viewed 134

I'm currently using image_picker_web: ^2.1.1 package for my project and this project will run on both app and web, however when i include this package and run on app, it will trigger me quite a lot of error and i assume it's because inside the package for function that is only for web. My question is there a way to handle the package, so that it will import only when run on web, and exclude it when run in app

1 Answers

I think you cannot stop it from importing in mobile app but yes you can use check using kIsWeb and use the image_picker functionality only when it is true.

Related