gpt4 book ai didi

flutter - 为什么在 dart/flutter 中序列化 JSON 时 build_runner 不生成文件

转载 作者:行者123 更新时间:2023-12-03 02:48:42 34 4
gpt4 key购买 nike

我只是想用我 3 个月前存储的相同命令来生成我的文件(我对后端和 devops 不太擅长),现在它不再生成文件了。
它告诉我使用我不记得的删除命令,但即使使用该命令,我的文件仍然不会生成。
这就是我的日志的样子,您可以在下面找到一个简单类的代码。

我的猜测之一是这与我更改 github 帐户有关,因为提到了权限问题。

我在 Windows 10 中使用 vs 代码。

日志文件:

E:\1 Work\flutter_pilot> flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 336ms

[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 12.5s

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

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Found 13 declared outputs which already exist on disk. This is likely because the`.dart_tool/build` folder was deleted, or you are submitting generated files to your source repository.
[SEVERE] Conflicting outputs were detected and the build is unable to prompt for permission to remove them. These outputs must be removed manually or the build can be run with `--delete-conflicting-outputs`. The outputs are: lib/models/advisory-service-item.g.dart
lib/models/advisory-service.g.dart
lib/models/auth.g.dart
lib/models/contract.g.dart
lib/models/contributor.g.dart
lib/models/exact-cost-values.g.dart
lib/models/exact-cost.g.dart
lib/models/expert.g.dart
lib/models/paginator-info.g.dart
lib/models/person.g.dart
lib/models/project.g.dart
lib/models/system-country.g.dart
lib/models/user.g.dart
pub failed (78)

类文件:
import 'package:json_annotation/json_annotation.dart';
part 'organisation.g.dart';

@JsonSerializable()
class Organisation {
final String name;
Organisation({this.name});

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

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

最佳答案

我有一个类似的问题,但我使用的是 Android Studio IDE,我已经完成了以下步骤:

文件 => 使缓存无效/重新启动

运行以下命令:

flutter clean

flutter pub get

flutter packages pub run build_runner build --delete-conflicting-outputs

关于flutter - 为什么在 dart/flutter 中序列化 JSON 时 build_runner 不生成文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59668548/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com