news model added
This commit is contained in:
parent
1379c96453
commit
7f23eb46c8
|
|
@ -0,0 +1,38 @@
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
@immutable
|
||||||
|
class NewsData {
|
||||||
|
final int id;
|
||||||
|
final String title;
|
||||||
|
final String reference;
|
||||||
|
final String description;
|
||||||
|
final String createdAt;
|
||||||
|
final String updatedAt;
|
||||||
|
|
||||||
|
const NewsData({
|
||||||
|
required this.id,
|
||||||
|
required this.title,
|
||||||
|
required this.reference,
|
||||||
|
required this.description,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory NewsData.fromJson(Map<String, dynamic> json) => NewsData(
|
||||||
|
id: json['id'],
|
||||||
|
title: json['title'],
|
||||||
|
reference: json['reference'],
|
||||||
|
description: json['description'],
|
||||||
|
createdAt: json['createdAt'],
|
||||||
|
updatedAt: json['updatedAt'],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'id': id,
|
||||||
|
'title': title,
|
||||||
|
'reference': reference,
|
||||||
|
'description': description,
|
||||||
|
'createdAt': createdAt,
|
||||||
|
'updatedAt': updatedAt,
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue