向应用程序添加 Web 支持时出现 Flutter 错误
Flutter error while adding web support to app
我刚刚发现我可以将我的flutter应用程序更改为一个网站而无需编写外部代码。我决定在我的应用程序上对其进行测试,但出现此错误并且我不知道如何修复它。我按照 "website" 上的步骤操作,但仍然出现错误。我的堆栈跟踪是:-
This application is not configured to build on the web.
To add web support to a project, run `flutter create .`.
Launching lib\main.dart on Web Server in debug mode...
Syncing files to device Web Server...
org-dartlang-app:/web_entrypoint.dart:8:8: Error: Error when reading 'lib/generated_plugin_registrant.dart': The system cannot find the file specified.
import 'package:discountapp/generated_plugin_registrant.dart';
^
org-dartlang-app:/web_entrypoint.dart:11:3: Error: Method not found: 'registerPlugins'.
registerPlugins(webPluginRegistry);
^^^^^^^^^^^^^^^
Failed to compile application.
我运行扑创建。它说
C:\Users\Hemant\AndroidStudioProjects\discountapp\ios>flutter create .
Recreating project ....
Wrote 3 files.
All done!
[√] Flutter: is fully installed. (Channel beta, 1.20.0-7.2.pre, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Chrome - develop for the web: is fully installed.
[√] Android Studio: is fully installed. (version 4.0)
[√] Connected device: is fully installed. (3 available)
In order to run your application, type:
$ cd .
$ flutter run
Your application code is in .\lib\main.dart.
C:\Users\Hemant\AndroidStudioProjects\discountapp\ios>flutter create .
Recreating project ....
Wrote 3 files.
All done!
[√] Flutter: is fully installed. (Channel beta, 1.20.0-7.2.pre, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Chrome - develop for the web: is fully installed.
[√] Android Studio: is fully installed. (version 4.0)
[√] Connected device: is fully installed. (3 available)
In order to run your application, type:
$ cd .
$ flutter run
Your application code is in .\lib\main.dart.
运行 扑 运行 会 运行 它在我的 phone 上。我将提供所需的任何代码。请帮忙
您必须 运行 flutter create .
在应用程序的根文件夹中,但不能在 ios
子文件夹中。
- 将
ios
文件夹重命名为 _ios
- 运行 在您的终端中执行此命令:
flutter create --platforms=web .
- 将
_ios
文件夹重新命名为 ios
这会将所有需要的文件写入 运行 您在浏览器上的应用程序。
我刚刚发现我可以将我的flutter应用程序更改为一个网站而无需编写外部代码。我决定在我的应用程序上对其进行测试,但出现此错误并且我不知道如何修复它。我按照 "website" 上的步骤操作,但仍然出现错误。我的堆栈跟踪是:-
This application is not configured to build on the web.
To add web support to a project, run `flutter create .`.
Launching lib\main.dart on Web Server in debug mode...
Syncing files to device Web Server...
org-dartlang-app:/web_entrypoint.dart:8:8: Error: Error when reading 'lib/generated_plugin_registrant.dart': The system cannot find the file specified.
import 'package:discountapp/generated_plugin_registrant.dart';
^
org-dartlang-app:/web_entrypoint.dart:11:3: Error: Method not found: 'registerPlugins'.
registerPlugins(webPluginRegistry);
^^^^^^^^^^^^^^^
Failed to compile application.
我运行扑创建。它说
C:\Users\Hemant\AndroidStudioProjects\discountapp\ios>flutter create .
Recreating project ....
Wrote 3 files.
All done!
[√] Flutter: is fully installed. (Channel beta, 1.20.0-7.2.pre, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Chrome - develop for the web: is fully installed.
[√] Android Studio: is fully installed. (version 4.0)
[√] Connected device: is fully installed. (3 available)
In order to run your application, type:
$ cd .
$ flutter run
Your application code is in .\lib\main.dart.
C:\Users\Hemant\AndroidStudioProjects\discountapp\ios>flutter create .
Recreating project ....
Wrote 3 files.
All done!
[√] Flutter: is fully installed. (Channel beta, 1.20.0-7.2.pre, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Chrome - develop for the web: is fully installed.
[√] Android Studio: is fully installed. (version 4.0)
[√] Connected device: is fully installed. (3 available)
In order to run your application, type:
$ cd .
$ flutter run
Your application code is in .\lib\main.dart.
运行 扑 运行 会 运行 它在我的 phone 上。我将提供所需的任何代码。请帮忙
您必须 运行 flutter create .
在应用程序的根文件夹中,但不能在 ios
子文件夹中。
- 将
ios
文件夹重命名为_ios
- 运行 在您的终端中执行此命令:
flutter create --platforms=web .
- 将
_ios
文件夹重新命名为ios
这会将所有需要的文件写入 运行 您在浏览器上的应用程序。