-1

(https://i.stack.imgur.com/GvVsx.png)

I want to save the Room ID included to the Room Details in the right.

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 04 '23 at 11:34

1 Answers1

0

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");
    }
  }
MrShakila
  • 874
  • 1
  • 4
  • 19