0
votes

MY PRODUCT.DART PAGE

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:uuid/uuid.dart';

class ProductService{
  FirebaseFirestore _firestore = FirebaseFirestore.instance;
  String ref = "products";

  void uploadProduct({String productName, String brand, String category, int quantity, List sizes, List images, double price}){
    var id = Uuid();
    String productId = id.v1();

_firestore.collection(ref).doc(productId).set({
  "name" = productName,
  "brand" = brand,
  "id" = productId,
  "category" = category,
});


 }
}

My problem is : I can not include those variables into method of data()

Errors:

error: The argument type 'Set<String>' can't be assigned to the parameter type 'Map<String, dynamic>'. (argument_type_not_assignable at [ecommerceadmin_app] lib\db\product.dart:12)
1

1 Answers

0
votes

Replace = with : as such:

_firestore.collection(ref).doc(productId).set({
  "name": productName,
  "brand": brand,
  "id": productId,
  "category": category,
});