(https://i.stack.imgur.com/GvVsx.png)
I want to save the Room ID included to the Room Details in the right.
(https://i.stack.imgur.com/GvVsx.png)
I want to save the Room ID included to the Room Details in the right.
You need to get the room id first to set the data to that id, like this
Future<void> addCategory(
BuildContext context,
String categoryName,
) async {
bool hasConnection = await NetworkConn.isInternet();
if (hasConnection) {
String categoryId = category.doc().id;///this is the id
return category.doc(categoryId).set({
'id': categoryId,///this is the in feild
'CategoryName': categoryName,
"AddedBy": user!.email,
"CreatedAt: ": DateTime.now().toString(),
}).then((value) {
CustomDialog.showSuccessDialog(context, "Category Added");
}).catchError((error) {
Logger().e("Failed to add user: $error");
CustomDialog.showErrorDialog(context, "Unable to add Category");
});
} else {
CustomDialog.showErrorDialog(context, "Please Connect to Internet");
}
}