Merge branch 'feature/null-safety' into core-nnbd
This commit is contained in:
@@ -23,7 +23,7 @@ OwnUser _$OwnUserFromJson(Map<String, dynamic> json) {
|
|||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
role: json['role'] as String? ?? '',
|
role: json['role'] as String,
|
||||||
createdAt: json['created_at'] == null
|
createdAt: json['created_at'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class User {
|
|||||||
/// Constructor used for json serialization
|
/// Constructor used for json serialization
|
||||||
User({
|
User({
|
||||||
required this.id,
|
required this.id,
|
||||||
this.role = '',
|
this.role,
|
||||||
DateTime? createdAt,
|
DateTime? createdAt,
|
||||||
DateTime? updatedAt,
|
DateTime? updatedAt,
|
||||||
this.lastActive,
|
this.lastActive,
|
||||||
@@ -41,9 +41,8 @@ class User {
|
|||||||
final String id;
|
final String id;
|
||||||
|
|
||||||
/// User role
|
/// User role
|
||||||
@JsonKey(
|
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||||
includeIfNull: false, toJson: Serialization.readOnly, defaultValue: '')
|
final String? role;
|
||||||
final String role;
|
|
||||||
|
|
||||||
/// User role
|
/// User role
|
||||||
@JsonKey(
|
@JsonKey(
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ part of 'user.dart';
|
|||||||
User _$UserFromJson(Map<String, dynamic> json) {
|
User _$UserFromJson(Map<String, dynamic> json) {
|
||||||
return User(
|
return User(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
role: json['role'] as String? ?? '',
|
role: json['role'] as String?,
|
||||||
createdAt: json['created_at'] == null
|
createdAt: json['created_at'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
|
|||||||
Reference in New Issue
Block a user