35 lines
809 B
Dart
35 lines
809 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:manager_api/api.dart';
|
|
|
|
class ResourceModel {
|
|
String? id = "";
|
|
String? data = "";
|
|
String? source = "";
|
|
String? label = "";
|
|
ResourceType? type;
|
|
|
|
ResourceModel({this.id, this.data, this.source, this.type});
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
'data': data,
|
|
'source': source,
|
|
'type': type?.value
|
|
};
|
|
}
|
|
|
|
factory ResourceModel.fromJson(Map<String, dynamic> json) {
|
|
return ResourceModel(
|
|
id: json['id'] as String,
|
|
data: json['data'] as String,
|
|
source: json['source'] as String,
|
|
type: json['type'] as ResourceType
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'ResourceModel{id: $id, type: $type, source: $source, data: $data, label: $label}';
|
|
}
|
|
} |