You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
971 B
31 lines
971 B
import 'package:cloud_firestore/cloud_firestore.dart';
|
|
import 'package:justmusic/model/User.dart';
|
|
|
|
class UserMapper {
|
|
static User toModel(DocumentSnapshot<Map<String, dynamic>> snapshot) {
|
|
final data = snapshot.data();
|
|
return User(
|
|
snapshot.id,
|
|
data?["pseudo"],
|
|
data?["unique_id"],
|
|
data?["mail"],
|
|
data?["picture"],
|
|
data?["token_notify"],
|
|
List<String>.from(data?["followers"] as List),
|
|
data?["nbCapsules"] ?? 0,
|
|
List<String>.from(data?["followed"] as List));
|
|
}
|
|
/*
|
|
static Map<String, dynamic> toFirebase(User user) {
|
|
return {
|
|
if (user.pseudo != null) "name": u,
|
|
if (user.country != null) "state": state,
|
|
if (user.mail != null) "country": country,
|
|
if (user.pp != null) "capital": capital,
|
|
if (user.followers != null) "population": population,
|
|
if (user.capsules != null) "regions": regions,
|
|
if ()
|
|
};
|
|
}*/
|
|
}
|