【问题标题】:$ flutter pub run build_runner build in project with hive not responding$ flutter pub run build_runner 在项目中构建,配置单元没有响应
【发布时间】:2021-04-10 21:14:13
【问题描述】:

当使用 hive 在项目中运行 $ flutter pub run build_runner build 时,它会停在这里(我什至已经等了 2 个小时,它不会再继续了), 我已经尝试创建一个专门用于配置单元实施的新项目。但这是同一个问题

[INFO] Generating build script...
[INFO] Generating build script completed, took 528ms
[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 21.3s
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 1.2s
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 2ms
[INFO] Running build...
[INFO] Generating SDK summary...

这是我的课:

import 'package:hive/hive.dart';

part 'person.g.dart';

@HiveType(typeId: 0)
class Person extends HiveObject {
  @HiveField(0)
  int id;
  @HiveField(1)
  String name;
  @HiveField(2)
  DateTime birthDate;
  Person(this.id, this.name, this.birthDate);
}

还有我的 pubspec.yaml 文件:

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  hive:
  hive_flutter:
  path_provider:

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner:
  hive_generator:


flutter:

  

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    我也遇到了同样的问题并解决了,

    flutter pub upgrade
    

    如果这对你没有帮助,那么也试试这些步骤

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

    【讨论】:

    • packagespub 是一种,你可以避免一种
    猜你喜欢
    • 1970-01-01
    • 2021-08-14
    • 1970-01-01
    • 1970-01-01
    • 2022-10-08
    • 1970-01-01
    • 2021-12-16
    • 2021-11-17
    • 2022-11-16
    相关资源
    最近更新 更多