User constructor

User({
  1. @JsonKey(name: 'userid') required int id,
  2. required String username,
  3. required String firstname,
  4. required String lastname,
  5. @Default(false) @JsonKey(name: 'ekenabled') @BoolConverterNullable() bool optionalTasksEnabled,
  6. @Default('') String email,
  7. @Default(-1) @JsonKey(name: 'capabilities') int capabilitiesBitMask,
  8. @Default('') @JsonKey(name: 'theme') String themeName,
  9. @Default('') @JsonKey(name: 'profileimageurl') String profileImageUrl,
  10. @Default(-1) @JsonKey(name: 'planid') int planId,
  11. @Default('') @JsonKey(name: 'colorblindness') String colorBlindnessString,
  12. @Default(false) @JsonKey(name: 'displaytaskcount') @BoolConverterNullable() bool displayTaskCount,
  13. Vintage? vintage,
})

A user using the application.

Implementation

factory User({
  /// The id of the user
  @JsonKey(name: 'userid') required int id,

  /// The username of the user
  required String username,

  /// The firstname of the user
  required String firstname,

  /// The lastname of the user
  required String lastname,

  /// `true` if [MoodleTask]s of type [MoodleTaskType.optional] are enabled.
  @Default(false) @JsonKey(name: 'ekenabled') @BoolConverterNullable() bool optionalTasksEnabled,

  /// The email address of the user
  @Default('') String email,

  /// A bitmask of the capabilities the user has
  @Default(-1) @JsonKey(name: 'capabilities') int capabilitiesBitMask,

  /// The name of the theme the user has selected
  @Default('') @JsonKey(name: 'theme') String themeName,

  /// The url of the profile image
  @Default('') @JsonKey(name: 'profileimageurl') String profileImageUrl,

  /// The id of the plan the user is assigned to
  @Default(-1) @JsonKey(name: 'planid') int planId,

  /// The color blindness of the user as a string
  @Default('') @JsonKey(name: 'colorblindness') String colorBlindnessString,

  /// Whether to display the task count in the calendar view
  @Default(false) @JsonKey(name: 'displaytaskcount') @BoolConverterNullable() bool displayTaskCount,

  /// The vintage of the user
  Vintage? vintage,
}) = _User;