flutter - 向应用程序添加 Web 支持时出现颤振错误
问题描述
我刚刚发现我可以在不编写外部代码的情况下将我的 Flutter 应用程序更改为网站。我决定在我的应用程序上测试它,但我收到了这个错误,我不知道如何修复它。我按照“网站”上的步骤操作,但仍然出现错误。我的堆栈跟踪是:-
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.
运行 flutter run 将在我的手机上运行它。我将提供所需的任何代码。请帮忙
解决方案
您必须flutter create .
在应用程序的根文件夹中运行,而不是在ios
子文件夹中。
推荐阅读
- php - Laravel 刀片更漂亮的格式,但删除了语法突出显示和片段
- ios - 在 iOS 13.0 SwiftUI 中使用 Butotnactios 更改滚动视图
- c# - C# EWS ExchangeService:我如何知道它是否已通过身份验证?
- javascript - 在移动网站上使用侧导航菜单的滚动中断
- reactjs - 如何让反应路由器启动并运行?
- javascript - Vue3中API的对象解构
- flutter - 颤动我想得到列表
值一一作为整数 - authorization - 无效资源或 Resource[id] 不存在 keycloak
- c - C vs 变量范围中的悬空指针问题
- javascript - parseInt() 发生了一些奇怪的事情