dart – How to convert the whole Hive Box to Map in flutter?

Overview:

I have a Flutter Hive called cartModel(); with typeadaper as such

@HiveType(typeId: 0)
class CartModel extends HiveObject {
  // for the product title
  @HiveField(0)
  late final String title;
  // for checking the store id
  @HiveField(1)
  late final String uid;
  // fot the product image
  @HiveField(2)
  late final String image;
  // for the discounted price
  @HiveField(3)
  late final double price;
  // for the original price
  @HiveField(4)
  late final double originalPrice;
  // for the quantity.
  @HiveField(5)
  late final int quantity;

  CartModel({
    required this.image,
    required this.originalPrice,
    required this.price,
    required this.quantity,
    required this.uid,
    required this.title,
  });
}

and the specific data is saved as CartModed<>.

Objective:

I want to convert the whole cartModel to a dart Map{} object and save it to the database (firebase firestore).

Problem I am facing:

I have a cartModel<>(imageUrl, title, price, quantity) I can access data of each model as such CartModel.image but the limitation is I can access specific data of a single index and when I try to access the whole box (hive box) it just shows Instance of CartModel<>.

What I’ve tried so far:

Hive.box('cartModel').value;  but it returns the above mentioned problem.

Full Code:

incase if you would be intrested to view the full code I have attached a github link bellow:

github link to full code.