KonectarEvents/lib/model/keywords_model.dart

48 lines
1008 B
Dart
Raw Permalink Normal View History

2024-09-06 06:30:31 +00:00
// To parse this JSON data, do
//
// final welcome = welcomeFromJson(jsonString);
import 'dart:convert';
KeywordsModel welcomeFromJson(String str) =>
KeywordsModel.fromJson(json.decode(str));
String welcomeToJson(KeywordsModel data) => json.encode(data.toJson());
class KeywordsModel {
List<Keyword> keyword;
KeywordsModel({
required this.keyword,
});
factory KeywordsModel.fromJson(Map<String, dynamic> json) => KeywordsModel(
keyword:
List<Keyword>.from(json["keyword"].map((x) => Keyword.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"keyword": List<dynamic>.from(keyword.map((x) => x.toJson())),
};
}
class Keyword {
String id;
String name;
Keyword({
required this.id,
required this.name,
});
factory Keyword.fromJson(Map<String, dynamic> json) => Keyword(
id: json["id"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
};
}