Steps to Reproduce
When run $ flutter pub run build_runner build in project with hive, not generate the file.g.dart file
[INFO] Generating build script...
[INFO] Generating build script completed, took 626ms
[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 141ms
[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 1.5s
[INFO] Running build...
[INFO] 1.4s elapsed, 0/2 actions completed.
[INFO] 3.0s elapsed, 0/2 actions completed.
[WARNING] hive_generator:hive_generator on lib/src/models/company.model.dart:
Missing "part 'company.model.g.dart';".
[WARNING] hive_generator:hive_generator on lib/src/models/user.model.dart:
Missing "part 'user.model.g.dart';".
[INFO] Running build completed, took 3.0s
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 59ms
[INFO] Succeeded after 3.1s with 0 outputs (2 actions)
Class User
import 'package:hive/hive.dart';
part 'user.g.dart';
@HiveType(typeId: 0)
class User extends HiveObject {
@HiveField(0)
String name;
@HiveField(1)
String phone;
@HiveField(2)
String street;
@HiveField(3)
String subStreet;
@HiveField(4)
String city;
@HiveField(5)
String state;
@HiveField(6)
String country;
@HiveField(7)
String latitude;
@HiveField(8)
String longitude;
User(
{this.name,
this.phone,
this.street,
this.subStreet,
this.city,
this.state,
this.country,
this.latitude,
this.longitude});
}
Class Company
import 'package:hive/hive.dart';
part 'company.g.dart';
@HiveType(typeId: 1)
class Company extends HiveObject {
@HiveField(0)
String name;
}
Version
I found the solution myself.
My files were called user.model.dart and company.model.dart
I changed them to user.dart and company.dart and ready, problem solved
Most helpful comment
I found the solution myself.
My files were called user.model.dart and company.model.dart
I changed them to user.dart and company.dart and ready, problem solved