famedlysdk/lib/src/utils/profile.dart

24 lines
802 B
Dart
Raw Normal View History

2019-11-30 09:36:30 +00:00
/// Represents a user profile returned by a /profile request.
class Profile {
/// The user's avatar URL if they have set one, otherwise null.
2020-04-24 07:24:06 +00:00
final Uri avatarUrl;
2019-11-30 09:36:30 +00:00
/// The user's display name if they have set one, otherwise null.
final String displayname;
/// This API may return keys which are not limited to displayname or avatar_url.
final Map<String, dynamic> content;
2020-05-18 11:45:49 +00:00
const Profile(this.displayname, this.avatarUrl, {this.content = const {}});
2019-11-30 09:36:30 +00:00
Profile.fromJson(Map<String, dynamic> json)
2020-05-18 11:45:49 +00:00
: avatarUrl =
json['avatar_url'] != null ? Uri.parse(json['avatar_url']) : null,
2019-11-30 09:36:30 +00:00
displayname = json['displayname'],
content = json;
2020-01-18 14:49:15 +00:00
@override
2020-01-18 14:49:15 +00:00
bool operator ==(dynamic other) =>
2020-04-24 07:24:06 +00:00
avatarUrl == other.avatarUrl && displayname == other.displayname;
2019-11-30 09:36:30 +00:00
}