Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/core/models/about/author.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import 'package:unn_mobile/core/constants/api/protocol_type.dart';
import 'package:unn_mobile/core/misc/json/json_utils.dart';

class _AuthorJsonKeys {
static const String userId = 'user_id';
static const String fullname = 'fullname';
static const String educationGroup = 'education_group';
static const String avatar = 'avatar';
}

class Author {
final int? userId;
final String fullname;
final String? educationGroup;
final String avatar;
Expand All @@ -23,16 +25,19 @@ class Author {
Author({
required this.fullname,
required this.avatar,
this.userId,
this.educationGroup,
});

factory Author.fromJson(JsonMap json) => Author(
userId: json[_AuthorJsonKeys.userId] as int?,
fullname: json[_AuthorJsonKeys.fullname]! as String,
educationGroup: json[_AuthorJsonKeys.educationGroup] as String?,
avatar: json[_AuthorJsonKeys.avatar]! as String,
);

JsonMap toJson() => {
_AuthorJsonKeys.userId: userId,
_AuthorJsonKeys.fullname: fullname,
_AuthorJsonKeys.educationGroup: educationGroup,
_AuthorJsonKeys.avatar: avatar,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: unn_mobile
description: A mobile application for UNN Portal website
publish_to: 'none'

version: 0.6.0+376
version: 0.6.0+377

environment:
sdk: '>=3.1.2 <4.0.0'
Expand Down