参数类型'Set<String>'不能分配给参数类型"映射<字符串,动态>



我的产品。飞镖页

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,
});

}
}

我的问题是:我不能将这些变量包含到data()方法

错误:

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

Replace = with: as such:

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

相关内容

最新更新