1

我在使用 build_runner 为我的 json 文件获取所需输出时遇到问题,它成功运行但没有提供任何输出

我的第一个 .dart 文件

```
import 'package:json_annotation/json_annotation.dart';

part 'first.g.dart';


@JsonSerializable()
class User {
String visibility, name;
User(this.visibility, this.name);

 factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);


 Map<String, dynamic> toJson() => _$UserToJson(this);
}
```

我的项目中是否需要任何 buil.yaml 文件?

我的 pubspec.yaml 文件

```
dependencies:
 flutter:
  sdk: flutter
 json_annotation: ^4.4.0
 http: ^0.13.4

dev_dependencies:
 flutter_test:
  sdk: flutter
 build_runner: ^2.1.7
 json_serializable: ^6.1.1
 ```

 

这是我的终端在执行命令后的样子

 flutter pub run build_runner build

终端

 PS D:\Flutter\json_parse\learn> flutter pub run build_runner build
 [INFO] Generating build script...
 [INFO] Generating build script completed, took 359ms

 [INFO] Precompiling build script......
 [INFO] Precompiling build script... completed, took 7.0s

 [INFO] Initializing inputs
 [INFO] Building new asset graph...
 [INFO] Building new asset graph completed, took 758ms

 [INFO] Checking for unexpected pre-existing outputs....
 [INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

 [INFO] Running build...
 [INFO] Generating SDK summary...
 [INFO] 3.5s elapsed, 0/3 actions completed.
 [INFO] Generating SDK summary completed, took 3.5s

 [INFO] 4.6s elapsed, 0/3 actions completed.
 [INFO] 5.6s elapsed, 0/3 actions completed.
 [INFO] 7.0s elapsed, 0/3 actions completed.
 [INFO] 12.9s elapsed, 1/3 actions completed.
 [INFO] Running build completed, took 13.6s

 [INFO] Caching finalized dependency graph...
 [INFO] Caching finalized dependency graph completed, took 30ms

 [INFO] Succeeded after 13.6s with 0 outputs (6 actions)

我没有得到我的代码中的问题

4

0 回答 0