User.fromJson constructor

User.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory User.fromJson(Map<String, dynamic> json) {
  return User(
    id: json['id'],
    displayName: json['display_name'] ?? '',
    email: json['email'],
    followers: json['followers'] != null ? json['followers']['total'] as int? : null,
    spotifyUrl: json['external_urls'] != null ? json['external_urls']['spotify'] : '',
    images: List<String>.from(
      (json['images'] ?? []).map((img) => img['url']),
    ),
  );
}