How to get userID from snapshot ? (Realtime Database)

You should create a model containing all your person information and when you get data from firebase you should convert it from json format to model format. After setting all the variables in the detail model and adding all the data, you must give the parameter to the page you want to show the person detail.

Here is example model

  class UserModel {
  String uid;
  String email;
  String name;
  String surname;
  String pathOfPhoto;
  String phoneNumber;

  UserModel(
    this.uid,
    this.email,
    this.name,
    this.surname,{
    this.pathOfPhoto,
    this.phoneNumber,
  });

  UserModel.fromMap(Map snapshot)
      : uid = snapshot['uid'] ?? '',
        email = snapshot['email'] ?? '',
        name = snapshot['name'] ?? '',
        surname = snapshot['surname'] ?? '',
        pathOfPhoto = snapshot['pathOfPhoto'] ?? '',
        phoneNumber = snapshot['phoneNumber'] ?? '';

  toJson() {
    return {
      "uid": uid,
      "email": email,
      "name": name,
      "surname": surname,
      "pathOfPhoto": pathOfPhoto,
      "phoneNumber": phoneNumber,
    };
  }
}