有一个问题,因为我想在我的flutter项目中使用由swagger-codegen生成的api库 .

我所做的:

  • 创建新项目 .

  • 使用swagger-codegen生成my_api .

  • 添加已创建的库,因为它显示在readme.md表单生成的代码中 .

  • 在项目中添加导入包 .

  • 在android studio中按下获取包按钮 .

  • 从生成的代码中添加readme.md中显示的示例代码 .

  • (到现在一切正常)

  • 收到错误 Not found: dart:html (粘贴在下面) .

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
compiler message: dart:html: Error: Not found: dart:html.
Compiler failed on C:\Users\Comarch\AndroidStudioProjects\flutter_with_api\lib\main.dart

FAILURE: Build failed with an exception.

* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 435

* What went wrong:
Execution failed for task ':app:flutterBuildDebug'.
> Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
Finished with error: Gradle build failed: 1

我正在使用:swagger-codegen(v.2.4.0)flutter(v.5.5-beta)android studio(v.3.1.3)