You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.5 KiB
89 lines
2.5 KiB
19 hours ago
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
@immutable
|
||
|
class ServerProblem {
|
||
|
final String id;
|
||
|
final String title;
|
||
|
final String location;
|
||
|
final String? censorTaskId;
|
||
|
final String? rowId;
|
||
|
final String? bindData;
|
||
|
final List<String>? imageUrls;
|
||
|
final DateTime creationTime;
|
||
|
final String creatorId;
|
||
|
final DateTime lastModificationTime;
|
||
|
final String lastModifierId;
|
||
|
|
||
|
const ServerProblem({
|
||
|
required this.id,
|
||
|
required this.title,
|
||
|
required this.location,
|
||
|
this.censorTaskId,
|
||
|
this.rowId,
|
||
|
this.bindData,
|
||
|
this.imageUrls,
|
||
|
required this.creationTime,
|
||
|
required this.creatorId,
|
||
|
required this.lastModificationTime,
|
||
|
required this.lastModifierId,
|
||
|
});
|
||
|
|
||
|
factory ServerProblem.fromJson(Map<String, dynamic> json) => ServerProblem(
|
||
|
id: json['id'] as String,
|
||
|
title: json['title'] as String,
|
||
|
location: json['location'] as String,
|
||
|
censorTaskId: json['censorTaskId'] as String?,
|
||
|
rowId: json['rowId'] as String?,
|
||
|
bindData: json['bindData'] as String?,
|
||
|
imageUrls: json['imageUrls'] as List<String>?,
|
||
|
creationTime: DateTime.parse(json['creationTime'] as String),
|
||
|
creatorId: json['creatorId'] as String,
|
||
|
lastModificationTime: DateTime.parse(
|
||
|
json['lastModificationTime'] as String,
|
||
|
),
|
||
|
lastModifierId: json['lastModifierId'] as String,
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
'id': id,
|
||
|
'title': title,
|
||
|
'location': location,
|
||
|
'censorTaskId': censorTaskId,
|
||
|
'rowId': rowId,
|
||
|
'bindData': bindData,
|
||
|
'imageUrls': imageUrls,
|
||
|
'creationTime': creationTime.toUtc().toIso8601String(),
|
||
|
'creatorId': creatorId,
|
||
|
'lastModificationTime': lastModificationTime.toUtc().toIso8601String(),
|
||
|
'lastModifierId': lastModifierId,
|
||
|
};
|
||
|
|
||
|
ServerProblem copyWith({
|
||
|
String? id,
|
||
|
String? title,
|
||
|
String? location,
|
||
|
String? censorTaskId,
|
||
|
String? rowId,
|
||
|
String? bindData,
|
||
|
List<String>? imageUrls,
|
||
|
DateTime? creationTime,
|
||
|
String? creatorId,
|
||
|
DateTime? lastModificationTime,
|
||
|
String? lastModifierId,
|
||
|
}) {
|
||
|
return ServerProblem(
|
||
|
id: id ?? this.id,
|
||
|
title: title ?? this.title,
|
||
|
location: location ?? this.location,
|
||
|
censorTaskId: censorTaskId ?? this.censorTaskId,
|
||
|
rowId: rowId ?? this.rowId,
|
||
|
bindData: bindData ?? this.bindData,
|
||
|
imageUrls: imageUrls ?? this.imageUrls,
|
||
|
creationTime: creationTime ?? this.creationTime,
|
||
|
creatorId: creatorId ?? this.creatorId,
|
||
|
lastModificationTime: lastModificationTime ?? this.lastModificationTime,
|
||
|
lastModifierId: lastModifierId ?? this.lastModifierId,
|
||
|
);
|
||
|
}
|
||
|
}
|