Store Locally list with hive in flutter

Viewed 28

the data of CategoryModel is storing in allCategory list, I want to store allCategory list locally with hive, how can I do? I tried many attempts but I could not. I also checked questions and answers on stack-overflow and many other websites, I did not get any answer which I wanted. I hope I explained well and you understood.

List<CategoryModel> allCategory  =[]; 

allCategory.add(CategoryModel(/*all variables data*/));


class CategoryModel {
  CategoryModel(
      {required this.type,
      this.iconData,
      this.imageList,
      this.notesText,
      this.reminderIcon,
      this.reminderText,
      this.reminderTimeText,
      this.titel,
      this.color,
      this.rawList,
      this.reminderwidth,
      this.backgroundImage,
      this.reminderColor,
      this.selectedTile,
      this.selectedimage,
      this.path,
      this.crossCount,
      this.duration,
      this.colorSelected,
      this.isSelected = false,
      this.checkScreen = false,
      this.notesController});
  final CategoryType type;
  String? titel;
  IconData? iconData;
  String? notesText;
  List<File>? imageList;
  IconData? reminderIcon;
  String? reminderText;
  String? reminderTimeText;
  Color? color;
  List<ListTileData>? rawList;
  double? reminderwidth;
  String? backgroundImage;
  Color? reminderColor;
  int? selectedTile;
  int? selectedimage;
  bool? checkScreen;
  String? notesController;
  int? crossCount;
  String? path;
  Duration? duration;
  int? colorSelected;
  bool? isSelected;
}
0 Answers
Related