Log
C:\Users\maiha\AndroidStudioProjects\crm>flutter packages pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 347ms
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 7.2s
[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
[SEVERE] /C:/flutter/.pub-cache/hosted/pub.dartlang.org/hive_generator-0.7.1/lib/src/type_adapter_generator.dart:60:76: Error: Getter not found: 'ENUM'. check(element
.kind == ElementKind.CLASS || element.kind == ElementKind.ENUM, ^^^^
pub finished with exit code 78
Class
import 'dart:convert';
import 'package:hive/hive.dart';
part 'AbstractDictionary.g.dart';
@HiveType(typeId: 0)
class AbstractDictionary {
AbstractDictionary({
this.id,
this.version,
this.createTs,
this.createdBy,
this.updateTs,
this.updatedBy,
this.deleteTs,
this.deletedBy,
this.legacyId,
this.langValue1,
this.description1,
this.langValue2,
this.description2,
this.langValue3,
this.description3,
this.langValue4,
this.description4,
this.langValue5,
this.description5,
this.startDate,
this.endDate,
this.code,
this.isSystemRecord,
this.active,
this.order,
this.name,
this.entityName,
});
@HiveField(0)
String id;
@HiveField(1)
int version;
@HiveField(2)
String entityName;
@HiveField(3)
DateTime createTs;
@HiveField(4)
String createdBy;
@HiveField(5)
DateTime updateTs;
@HiveField(6)
String updatedBy;
@HiveField(7)
DateTime deleteTs;
@HiveField(8)
String deletedBy;
@HiveField(9)
String legacyId;
@HiveField(10)
String langValue1;
@HiveField(11)
String description1;
@HiveField(12)
String langValue2;
@HiveField(13)
String description2;
@HiveField(14)
String langValue3;
@HiveField(15)
String description3;
@HiveField(16)
String langValue4;
@HiveField(17)
String description4;
@HiveField(18)
String langValue5;
@HiveField(19)
String description5;
@HiveField(20)
DateTime startDate;
@HiveField(21)
DateTime endDate;
@HiveField(22)
String code;
@HiveField(23)
bool isSystemRecord;
@HiveField(24)
bool active;
@HiveField(25)
int order;
@HiveField(26)
String name;
factory AbstractDictionary.fromJson(String str) => AbstractDictionary.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory AbstractDictionary.fromMap(Map<String, dynamic> json) => AbstractDictionary(
id: json['id'],
entityName: json['_entityName'],
version: json['version'],
createTs: json['createTs'] == null ? null : DateTime.parse(json['createTs']),
createdBy: json['createdBy'],
updateTs: json['updateTs'] == null ? null : DateTime.parse(json['updateTs']),
updatedBy: json['updatedBy'],
deleteTs: json['deleteTs'] == null ? null : DateTime.parse(json['deleteTs']),
deletedBy: json['deletedBy'],
legacyId: json['legacyID'],
langValue1: json['langValue1'],
description1: json['description1'],
langValue2: json['langValue2'],
description2: json['description2'],
langValue3: json['langValue3'],
description3: json['description3'],
langValue4: json['langValue4'],
description4: json['description4'],
langValue5: json['langValue5'],
description5: json['description5'],
startDate: json['startDate'] == null ? null : DateTime.parse(json['startDate']),
endDate: json['endDate'] == null ? null : DateTime.parse(json['endDate']),
code: json['code'],
isSystemRecord: json['isSystemRecord'],
active: json['active'],
order: json['order'],
name: json['name'],
);
Map<String, dynamic> toMap() => {
'id': id,
'_entityName': entityName,
'version': version,
};
}
flutter doctor.
Doctor summary (to see all details, run flutter doctor -v):
[鈭歖 Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
[鈭歖 Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[鈭歖 Android Studio (version 4.0)
[!] IntelliJ IDEA Ultimate Edition (version 2019.3)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[鈭歖 VS Code (version 1.47.3)
[!] Connected device
! No devices available
pubspec
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl_translation: ^0.17.1
responsive_builder: ^0.2.0+2
provider: ^4.0.5+1
get: ^3.1.1
charts_flutter: ^0.9.0
cupertino_icons: ^0.1.3
google_fonts: ^1.1.0
table_calendar: ^2.2.3
flutter_login: ^1.0.14
font_awesome_flutter: ^8.8.1
fsearch: ^1.0.0
supercharged: ^1.7.0
kinfolk_gui: ^1.0.0+1
hive: ^1.4.1+1
hive_flutter: ^0.3.0+2
kinfolk: ^0.0.8
flutter_intl:
enabled: true
dependency_overrides:
path: 1.7.0
dev_dependencies:
flutter_test:
sdk: flutter
hive_generator: ^0.7.0+2
build_runner: ^1.8.1
version ^1.4.3 same problem
Please update the hive_generator to the latest version.
I've got a similar problem, this is my code:
pubspec.yaml
environment:
sdk: ">=2.9.0 <3.0.0"
flutter: ">=1.10.0 <2.0.0"
dependencies:
flutter:
sdk: flutter
http: ^0.12.1
google_fonts: ^1.1.0
cached_network_image: ^2.2.0+1
crypto: ^2.1.4
intl: ^0.16.1
share: ^0.6.4+3
url_launcher: ^5.4.10
flutter_native_splash: ^0.1.9
fluentui_icons: ^0.2.0
package_info: ^0.4.0+18
webview_flutter: ^0.3.22+1
fluttertoast: ^4.0.1
mobx: ^1.2.1+2
flutter_mobx: ^1.1.0+2
provider: ^4.1.2
flutter_circular_chart: ^0.1.0
hive: ^1.4.3
hive_flutter: ^0.3.1
#FIREBASE
firebase_crashlytics: ^0.1.3+3
firebase_analytics: ^5.0.14
firebase_core: ^0.4.5
dev_dependencies:
flutter_launcher_icons: ^0.7.5
flutter_test:
sdk: flutter
hive_generator: ^0.7.1
build_runner: ^1.10.0
mobx_codegen: ^1.1.0+1
single_purchase.dart
import 'package:hive/hive.dart';
part 'single_purchase.g.dart';
@HiveType(typeId: 2)
class SinglePurchase {
@HiveField(0)
String id;
@HiveField(1)
double amount;
@HiveField(2)
String currencyCode;
@HiveField(3)
double purchasePrice;
SinglePurchase({this.id, this.amount, this.currencyCode, this.purchasePrice});
SinglePurchase.fromJson(Map<String, dynamic> json) {
id = json['id'];
amount = json['amount'];
currencyCode = json['currencyCode'];
purchasePrice = json['purchasePrice'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['amount'] = this.amount;
data['currencyCode'] = this.currencyCode;
data['purchasePrice'] = this.purchasePrice;
return data;
}
}
if I run flutter packages pub run build_runner build, this is the output:
Precompiling executable...
Failed to precompile build_runner:build_runner:
../../flutter/.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.9/lib/src/resolver.dart:340:10: Error: Method not found: 'SummaryBuilder'.
return SummaryBuilder(sdkSources, sdk.context).build(
^^^^^^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.9/lib/src/resolver.dart:329:7: Error: The setter 'useSummary' isn't defined for the class 'FolderBasedDartSdk'.
- 'FolderBasedDartSdk' is from 'package:analyzer/src/dart/sdk/sdk.dart' ('../../flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.14/lib/src/dart/sdk/sdk.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named 'useSummary'.
..useSummary = false
^^^^^^^^^^
pub finished with exit code 1
If I add, as suggested here #387,
dependency_overrides:
analyzer: 0.39.14
I got the same output.
Note
In my project I've also mobx to manage state and it also use build_runner to generate its stuff and now I lost also its part files.
Please update the
hive_generatorto the latest version.
doesn't help, still see this error
C:\Users\maiha\AndroidStudioProjects\crm>flutter packages pub run build_runner bu
ild --delete-conflicting-outputs
Precompiling executable...
Precompiled build_runner:build_runner.
[INFO] Generating build script...
[INFO] Generating build script completed, took 338ms
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 5.5s
[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
[SEVERE] /C:/flutter/.pub-cache/hosted/pub.dartlang.org/hive_generator-0.7.1/lib/
src/type_adapter_generator.dart:60:76: Error: Getter not found: 'ENUM'. check(
element.kind == ElementKind.CLASS || element.kind == ElementKind.ENUM,
^^^^
pub finished with exit code 78
I think its on version Flutter Channel stable, 1.20.1 , because my coworker on version 1.20.0 generate adapters without any problem
@polilluminato solved with modified pubspec
environment:
sdk: ">=2.9.0-13.0 <3.0.0" <- modified to solve build_runner
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl_translation: ^0.17.1
responsive_builder: ^0.2.0+2
provider: ^4.0.5+1
get: ^3.1.1
charts_flutter: ^0.9.0
cupertino_icons: ^0.1.3
google_fonts: ^1.1.0
table_calendar: ^2.2.3
flutter_login: ^1.0.14
font_awesome_flutter: ^8.8.1
fsearch: ^1.0.0
supercharged: ^1.7.0
kinfolk_gui: ^1.0.0+1
hive: ^1.4.3
hive_flutter: ^0.3.1
kinfolk: ^0.0.8
build_resolvers: ^1.3.11 <- modified to solve build_runner
flutter_intl:
enabled: true
dependency_overrides:
path: 1.7.0
dev_dependencies:
flutter_test:
sdk: flutter
hive_generator: ^0.7.1
build_runner: ^1.10.0
Most helpful comment
@polilluminato solved with modified pubspec