Issue
I found how to migrate "Flutter for mobile" to "Flutter for web". https://github.com/flutter/flutter_web/blob/master/docs/migration_guide.md
but, I need the opposite way.
I had tried only "flutter run", and of course, it doesn't run well.
I don't understand where to replace.
name: my_app
version: 1.0.0
dependencies:
## REPLACE
## Update your dependencies to use `flutter_web`
#flutter:
# sdk: flutter
flutter_web: any
dev_dependencies:
## REPLACE
## Same goes for test packages
#flutter_test:
# sdk: flutter
flutter_web_test: any
## ADD
## Add these dependencies to enable the Dart web build system
build_runner: ^1.2.2
build_web_compilers: ^1.1.0
test: ^1.3.4
## REMOVE
## For the preview, assets are handled differently. Remove or comment
## out this section. See `Assets` below for more details
# flutter:
# uses-material-design: true
# assets:
# - asset/
#
# fonts:
# - family: Plaster
# fonts:
# - asset: asset/fonts/plaster/Plaster-Regular.ttf
## ADD
## flutter_web packages are not published to pub.dartlang.org
## These overrides tell the package tools to get them from GitHub
dependency_overrides:
flutter_web:
git:
url: https://github.com/flutter/flutter_web
path: packages/flutter_web
flutter_web_ui:
git:
url: https://github.com/flutter/flutter_web
path: packages/flutter_web_ui
I hope there is a way to migrate, even if that's complicated. What I am trying to migrate is below. https://github.com/flutter/flutter_web/tree/master/examples/gallery
Solution
Yes, a think you can do it.
First thing you should do is: update your pubspec.yaml
file to something like this:
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
After running flutter packages get
errors will come from everywhere so,
you have to update every import in each file under lib directory.
It will be something like this:
import 'package:flutter_web/material.dart'
to import 'package:flutter/material.dart';
After that you will have to create again the project in order to get the android and ios projects directories.
To do that, you have to go to terminal, the navigate to the root directory of your project and run this command flutter create .
And finally, just run your project.
Answered By - Sergio Bernal Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.