Group.fromMap constructor

Group.fromMap(
  1. Map<String, dynamic> map,
  2. String id
)

//////////// //////////// Creates a Group from a Firestore document map

Implementation

// II.C - Factory Methods
///////////////
/// Creates a Group from a Firestore document map
factory Group.fromMap(Map<String, dynamic> map, String id) {
  return Group(
    id: id,
    name: map['name'] ?? 'Unnamed Group',
    createdBy: map['createdBy'] ?? '',
    members: List<String>.from(map['members'] ?? []),
    isPublic: map['isPublic'] ?? false,
    publicLinkCode: map['publicLinkCode'],
    createdAt: map['createdAt'] as Timestamp? ?? Timestamp.now(),
    locationSharingEnabled: map['locationSharingEnabled'] ?? true,
  );
}