hive_generator: not generate file .g.dart

Created on 24 Dec 2019  路  5Comments  路  Source: hivedb/hive

Steps to Reproduce
Follow todo example.

  1. Create file doto.dart and add the class todo as example
    todo.dart:
    import 'package:hive/hive.dart';

@HiveType()
class Todo extends HiveObject {
@HiveField(0)
String name;

@HiveField(1)
DateTime createDate;

@HiveField(2)
bool done = false;
}

  1. run command: flutter packages pub run build_runner build --delete-conflicting-outputs

Result:
I got message and there is no file todo.g.dart
(base)iMac:location user$ flutter packages pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 561ms

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

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

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Deleting 1 declared outputs which already existed on disk.
[INFO] Checking for unexpected pre-existing outputs. completed, took 6ms

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

[INFO] 5.5s elapsed, 1/17 actions completed.
[INFO] 6.5s elapsed, 3/19 actions completed.
[INFO] 7.7s elapsed, 3/19 actions completed.
[INFO] 8.9s elapsed, 3/19 actions completed.
[INFO] 9.9s elapsed, 3/19 actions completed.
[INFO] 11.0s elapsed, 3/19 actions completed.
[INFO] 12.1s elapsed, 3/19 actions completed.
[INFO] 13.2s elapsed, 3/19 actions completed.
[INFO] 19.9s elapsed, 4/19 actions completed.
[INFO] 21.0s elapsed, 4/20 actions completed.
[WARNING] hive_generator:hive_generator on lib/features/storage/Hive/todo.dart:
Missing "part 'todo.g.dart';".
[INFO] 22.8s elapsed, 19/21 actions completed.
[INFO] Running build completed, took 22.9s

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

[INFO] Succeeded after 23.0s with 0 outputs (42 actions)

Code sample

Provide a few simple lines of code to show your problem.

Version

  • Platform: iOS, Android, Mac, Windows, Linux, Web
  • Flutter version: [1.12.13]
  • Hive version: [1.1.1]
question

Most helpful comment

You need to add part 'todo.g.dart' at the beginning of your todo.dart file.

All 5 comments

You need to add part 'todo.g.dart' at the beginning of your todo.dart file.

Thanks a lot, it my fail not follow carefully guide.

Thanks a lot, it my fail not follow carefully guide.

Hi, what's the issue you have? I have same issue but I dont know what Im missing.

Thanks a lot, it my fail not follow carefully guide.

Hi, what's the issue you have? I have same issue but I dont know what Im missing.

Could you share your code?

Add this to pubspec.yml:

dev_dependencies:
  hive_generator: 
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ninest picture ninest  路  3Comments

kaboc picture kaboc  路  3Comments

ProfileID picture ProfileID  路  4Comments

NourEldinShobier picture NourEldinShobier  路  3Comments

yaymalaga picture yaymalaga  路  4Comments