无法在chrome上运行flutter项目

问题描述 投票:0回答:1

我创建了一个示例 flutter 项目,我想在 chrome 中查看结果。

当我在 chrome 上运行

main.dart
时,我得到一个白色的空白页!

这是我的

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
Flutter (Channel stable, 3.3.0, on Ubuntu 22.04.1 LTS 5.15.0-56- 
generic,locale en_US.UTF-8)
Android toolchain - develop for Android devices
    cmdline-tools component is missing
    Run `path/to/sdkmanager --install "cmdline-tools;latest"`
    See https://developer.android.com/studio/command-line for more 
    details.
Chrome - develop for the web
Linux toolchain - develop for Linux desktop
    clang++ is required for Linux development.
    It is likely available from your distribution (e.g.: apt 
    install clang), or can be downloaded from 
    https://releases.llvm.org/
CMake is required for Linux development.
    It is likely available from your distribution (e.g.: apt 
    install cmake), or can be downloaded from 
    https://cmake.org/download/
ninja is required for Linux development.
    It is likely available from your distribution (e.g.: apt 
    install ninja-build), or can be downloaded from 
    https://github.com/ninja-build/ninja/releases
pkg-config is required for Linux development.
    It is likely available from your distribution (e.g.: apt 
    install pkg-config), or can be downloaded from 
    https://www.freedesktop.org/wiki/Software/pkg-config/
Android Studio
    android-studio-dir = 
    /home/mbunderline76/.local/share/JetBrains/Toolbox/apps/IDEA- 
    U/ch-0
Unable to find bundled Java version.
IntelliJ IDEA Ultimate Edition (version 2022.3)
Connected device (2 available)
HTTP Host Availability
Doctor found issues in 3 categories.

enter image description here

知道发生了什么事吗? 顺便说一句,我正在使用 Intellij Idea Ultimate

flutter
1个回答
2
投票

首先解决这些问题。

Flutter 命令行工具

Flutter Java 捆绑链接

然后再次运行

flutter doctor
以确保这些错误消失。

然后运行

flutter -v -d chrome run
或者在您的 Vscode 或 AndroidStudio 中选择“Chrome Web”。

希望这有效,享受。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.