update user model
This commit is contained in:
@@ -8,8 +8,8 @@ part 'user.g.dart';
|
||||
class User {
|
||||
/// Constructor used for json serialization
|
||||
User({
|
||||
this.id = '',
|
||||
this.role = '',
|
||||
required this.id,
|
||||
this.role,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
this.lastActive,
|
||||
@@ -24,18 +24,6 @@ class User {
|
||||
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields));
|
||||
|
||||
/// Use this named constructor to create a new user instance
|
||||
User.init(
|
||||
this.id, {
|
||||
this.online = false,
|
||||
this.extraData = const {},
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.teams = const [],
|
||||
required this.role,
|
||||
}) : lastActive = null,
|
||||
banned = false;
|
||||
|
||||
/// Known top level fields.
|
||||
/// Useful for [Serialization] methods.
|
||||
static const topLevelFields = [
|
||||
@@ -53,9 +41,8 @@ class User {
|
||||
final String id;
|
||||
|
||||
/// User role
|
||||
@JsonKey(
|
||||
includeIfNull: false, toJson: Serialization.readOnly, defaultValue: '')
|
||||
final String role;
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final String? role;
|
||||
|
||||
/// User role
|
||||
@JsonKey(
|
||||
|
||||
Reference in New Issue
Block a user