4

I'm trying to store a list of objects with Hive in flutter.

The ChatModel (chat_model.dart) class looks like this:

import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';

part 'chat_model.g.dart';

@immutable
@HiveType(typeId: 1)
class ChatModel extends HiveObject {
  @HiveField(0)
  final String id;
  @HiveField(1)
  final String message;
  @HiveField(2)
  final bool isMe;

  ChatModel(
      {required this.id, required this.message, required this.isMe});
}

When I run flutter packages pub run build_runner build --delete-conflicting-outputs I always got an error :

[SEVERE] Nothing can be built, yet a build was requested. and the chat_model.g.dart file will not be generated. Do you have any suggestion for this?

Ballazx
  • 431
  • 4
  • 12

0 Answers0