40 lines
898 B
Dart
40 lines
898 B
Dart
// To parse this JSON data, do
|
|
//
|
|
// final patent = patentFromJson(jsonString);
|
|
|
|
import 'dart:convert';
|
|
|
|
List<Patent> patentFromJson(String str) =>
|
|
List<Patent>.from(json.decode(str).map((x) => Patent.fromJson(x)));
|
|
|
|
String patentToJson(List<Patent> data) =>
|
|
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
|
|
|
|
class Patent {
|
|
int id;
|
|
int userId;
|
|
String patentTitle;
|
|
String status;
|
|
|
|
Patent({
|
|
required this.id,
|
|
required this.userId,
|
|
required this.patentTitle,
|
|
required this.status,
|
|
});
|
|
|
|
factory Patent.fromJson(Map<String, dynamic> json) => Patent(
|
|
id: json["id"],
|
|
userId: json["user_id"],
|
|
patentTitle: json["Patent Title"],
|
|
status: json["Status"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"user_id": userId,
|
|
"Patent Title": patentTitle,
|
|
"Status": status,
|
|
};
|
|
}
|