-
Notifications
You must be signed in to change notification settings - Fork 1
Upgrading from package:flutter_web to the Flutter SDK
This guide is for updating projects that currently use package:flutter_web to use the Flutter SDK.
You might have a web/main.dart file that looks like:
import 'package:flutter_web_ui/ui.dart' as ui;
import 'package:example/main.dart' as app;
main() async {
await ui.webOnlyInitializePlatform();
app.main();
}Remove these files. An equivalent web/ directory will be created automatically in the next step.
Flutter has a web runner that can be initialized using the flutter create command:
flutter create .Change:
dependencies:
flutter_web: any
flutter_web_ui: any
to:
dependencies:
flutter:
sdk: flutterRemove the FontManifest.json file and specify the fonts the standard way. See this cookbook article for an example.
Assets should be placed in a top-level assets/ directory and specified in the pubspec.yaml:
flutter:
assets:
- preview.pngAlternatively, an entire top-level directory can be used, for example, my_assets. In this configuration, the directory must be specified in the pubspec:
flutter:
assets:
- my_assets/Any Dart files using flutter_web should use package:flutter instead. For example:
import 'package:flutter_web/material.dart';
import 'package:flutter_web_ui/ui.dart';Changes to:
import package:'flutter/material.dart';
import 'dart:ui';Instead of using webdev serve or pub run build_runner serve, use flutter run -d chrome
- Home of the Wiki
- Roadmap
- API Reference (stable)
- API Reference (master)
- Glossary
- Contributor Guide
- Chat on Discord
- Code of Conduct
- Issue triage reports
- Our Values
- Tree hygiene
- Issue hygiene and Triage
- Style guide for Flutter repo
- Project teams
- Contributor access
- What should I work on?
- Running and writing tests
- Release process
- Rolling Dart
- Manual Engine Roll with Breaking Commits
- Updating Material Design Fonts & Icons
- Postmortems
- Setting up the Framework development environment
- The Framework architecture
- The flutter tool
- API Docs code block generation
- Running examples
- Using the Dart analyzer
- The flutter run variants
- Test coverage for package:flutter
- Writing a golden-file test for package:flutter
- Setting up the Engine development environment
- Compiling the engine
- Debugging the engine
- Using Sanitizers with the Flutter Engine
- Testing the engine
- The Engine architecture
- Flutter's modes
- Engine disk footprint
- Comparing AOT Snapshot Sizes
- Custom Flutter engine embedders
- Custom Flutter Engine Embedding in AOT Mode
- Flutter engine operation in AOT Mode
- Engine-specific Service Protocol extensions
- Crashes
- Supporting legacy platforms
- Metal on iOS FAQ
- Engine Clang Tidy Linter
- Why we have a separate engine repo
- Reduce Flutter engine size with MLGO
- Setting up the Plugins development environment
- Setting up the Packages development environment
- Plugins and Packages repository structure
- Plugin Tests
- Contributing to Plugins and Packages
- Releasing a Plugin or Package
- Unexpected Plugins and Packages failures
