Reputation: 486
I have a mobile app written with flutter and i would like to convert it into a flutter_web app (integrating flutter_web is not available yet). I'm currently having problems with packages.
I have followed the instructions listed in this website https://www.codemitter.com/how-to-add-web-counterpart-in-an-existing-flutter-project/
I get the following errors
webdev could not run for this project.
You have a dependency on `cached_network_image` which is not supported for flutter_web tech preview. See https://flutter.dev/web for more details.
You have a dependency on `cloud_firestore` which is not supported for flutter_web tech preview. See https://flutter.dev/web for more details.
You have a dependency on `cupertino_icons` which is not supported for flutter_web tech preview. See https://flutter.dev/web for more details.
You have a dependency on `firebase_core` which is not supported for flutter_web tech preview. See https://flutter.dev/web for more details.
You have a dependency on `flutter` which is not supported for flutter_web tech preview. See https://flutter.dev/web for more details.
You have a dependency on `path_provider` which is not supported for flutter_web tech preview. See https://flutter.dev/web for more details.
You have a dependency on `sqflite` which is not supported for flutter_web tech preview. See https://flutter.dev/web for more details.
pub finished with exit code 78
are the flutter_web versions for the following plugins? how would one manually/automatically change such a plugin to be supported on flutter_web?
Upvotes: 4
Views: 14945
Reputation: 268544
Beginning with Flutter v1.10
, you can migrate your Flutter app to Web.
Enable web support by running:
flutter config --enable-web
Now, if you want to create a new project you can run
flutter create project_name
or if you want to migrate your existing one to web, run
flutter create .
Check connected devices by running:
flutter devices
Run your app in chrome by running:
flutter run -d chrome
Upvotes: 2
Reputation: 8730
Steps to follow while migration to Flutter Web:
update build config according to the migration guide
replace all flutter imports with flutter_web
remove all plugins that depend on native platforms (android or ios) and replace them with equivalents from dart:html or pure dart web libraries (https://pub.dev/web)
use forked non-native libraries that depend on flutter framework, like this https://github.com/rrousselGit/provider/issues/82 you might need to create a fork yourself like this: https://github.com/kevmoo/provider/commit/bb739c96463347dd185331655e1d8895665172b9
Steps 1. and 2. are pice of cake. But 3. and 4. might be very paintful.
Upvotes: 5
Reputation: 10935
Plugins are not yet supported on flutter_web
and we don't yet have details on what the migration story will look like. Plugins which call through to native Java or Swift code will not be possible to migrate automatically. Any code which imports dart:io
or dart:isolate
is also unsupported and would need to be rewritten.
Upvotes: 2