xxxxxxxxxx
class Autogenerated {
Id iId;
String name;
String email;
String password;
String address;
String type;
List<Null> cart;
V vV;
Autogenerated(
{this.iId,
this.name,
this.email,
this.password,
this.address,
this.type,
this.cart,
this.vV});
Autogenerated.fromJson(Map<String, dynamic> json) {
iId = json['_id'] != null ? new Id.fromJson(json['_id']) : null;
name = json['name'];
email = json['email'];
password = json['password'];
address = json['address'];
type = json['type'];
if (json['cart'] != null) {
cart = new List<Null>();
json['cart'].forEach((v) {
cart.add(new Null.fromJson(v));
});
}
vV = json['__v'] != null ? new V.fromJson(json['__v']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.iId != null) {
data['_id'] = this.iId.toJson();
}
data['name'] = this.name;
data['email'] = this.email;
data['password'] = this.password;
data['address'] = this.address;
data['type'] = this.type;
if (this.cart != null) {
data['cart'] = this.cart.map((v) => v.toJson()).toList();
}
if (this.vV != null) {
data['__v'] = this.vV.toJson();
}
return data;
}
}
class Id {
String oid;
Id({this.oid});
Id.fromJson(Map<String, dynamic> json) {
oid = json['$oid'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['$oid'] = this.oid;
return data;
}
}
class V {
String numberInt;
V({this.numberInt});
V.fromJson(Map<String, dynamic> json) {
numberInt = json['$numberInt'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['$numberInt'] = this.numberInt;
return data;
}
}
xxxxxxxxxx
class TrendingMoviesModel {
String? name;
String? backdropPath;
List<int>? genreIds;
String? originalLanguage;
String? posterPath;
List<String>? originCountry;
String? overview;
String? mediaType;
TrendingMoviesModel(
{this.name,
this.backdropPath,
this.genreIds,
this.originalLanguage,
this.posterPath,
this.originCountry,
this.overview,
this.mediaType});
TrendingMoviesModel.fromJson(Map<String, dynamic> json) {
name = json['name'];
backdropPath = json['backdrop_path'];
genreIds = json['genre_ids'].cast<int>();
originalLanguage = json['original_language'];
posterPath = json['poster_path'];
originCountry = json['origin_country'].cast<String>();
overview = json['overview'];
mediaType = json['media_type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['backdrop_path'] = this.backdropPath;
data['genre_ids'] = this.genreIds;
data['original_language'] = this.originalLanguage;
data['poster_path'] = this.posterPath;
data['origin_country'] = this.originCountry;
data['overview'] = this.overview;
data['media_type'] = this.mediaType;
return data;
}
}
xxxxxxxxxx
class DataDTO {
String? _name;
String? _gender;
int? _age;
Address? _address;
List<PhoneNumber>? _phoneNumber;
DataDTO(
{String? name,
String? gender,
int? age,
Address? address,
List<PhoneNumber>? phoneNumber}) {
if (name != null) {
this._name = name;
}
if (gender != null) {
this._gender = gender;
}
if (age != null) {
this._age = age;
}
if (address != null) {
this._address = address;
}
if (phoneNumber != null) {
this._phoneNumber = phoneNumber;
}
}
String? get name => _name;
set name(String? name) => _name = name;
String? get gender => _gender;
set gender(String? gender) => _gender = gender;
int? get age => _age;
set age(int? age) => _age = age;
Address? get address => _address;
set address(Address? address) => _address = address;
List<PhoneNumber>? get phoneNumber => _phoneNumber;
set phoneNumber(List<PhoneNumber>? phoneNumber) => _phoneNumber = phoneNumber;
DataDTO.fromJson(Map<String, dynamic> json) {
_name = json['name'];
_gender = json['gender'];
_age = json['age'];
_address =
json['address'] != null ? new Address.fromJson(json['address']) : null;
if (json['phoneNumber'] != null) {
_phoneNumber = <PhoneNumber>[];
json['phoneNumber'].forEach((v) {
_phoneNumber!.add(new PhoneNumber.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this._name;
data['gender'] = this._gender;
data['age'] = this._age;
if (this._address != null) {
data['address'] = this._address!.toJson();
}
if (this._phoneNumber != null) {
data['phoneNumber'] = this._phoneNumber!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Address {
String? _street;
String? _city;
String? _state;
String? _postalCode;
Address({String? street, String? city, String? state, String? postalCode}) {
if (street != null) {
this._street = street;
}
if (city != null) {
this._city = city;
}
if (state != null) {
this._state = state;
}
if (postalCode != null) {
this._postalCode = postalCode;
}
}
String? get street => _street;
set street(String? street) => _street = street;
String? get city => _city;
set city(String? city) => _city = city;
String? get state => _state;
set state(String? state) => _state = state;
String? get postalCode => _postalCode;
set postalCode(String? postalCode) => _postalCode = postalCode;
Address.fromJson(Map<String, dynamic> json) {
_street = json['street'];
_city = json['city'];
_state = json['state'];
_postalCode = json['postalCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['street'] = this._street;
data['city'] = this._city;
data['state'] = this._state;
data['postalCode'] = this._postalCode;
return data;
}
}
class PhoneNumber {
String? _type;
String? _number;
PhoneNumber({String? type, String? number}) {
if (type != null) {
this._type = type;
}
if (number != null) {
this._number = number;
}
}
String? get type => _type;
set type(String? type) => _type = type;
String? get number => _number;
set number(String? number) => _number = number;
PhoneNumber.fromJson(Map<String, dynamic> json) {
_type = json['type'];
_number = json['number'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['type'] = this._type;
data['number'] = this._number;
return data;
}
}
xxxxxxxxxx
class Autogenerated {
int? id;
int? age;
String? name;
Autogenerated({this.id, this.age, this.name});
Autogenerated.fromJson(Map<String, dynamic> json) {
id = json['id'];
age = json['age'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['age'] = this.age;
data['name'] = this.name;
return data;
}
}
xxxxxxxxxx
class Character {
int? id;
String? name;
String? status;
String? species;
String? type;
String? gender;
Origin? origin;
Origin? location;
String? image;
List<String>? episode;
String? url;
String? created;
Character(
{this.id,
this.name,
this.status,
this.species,
this.type,
this.gender,
this.origin,
this.location,
this.image,
this.episode,
this.url,
this.created});
Character.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
status = json['status'];
species = json['species'];
type = json['type'];
gender = json['gender'];
origin =
json['origin'] != null ? new Origin.fromJson(json['origin']) : null;
location =
json['location'] != null ? new Origin.fromJson(json['location']) : null;
image = json['image'];
episode = json['episode'].cast<String>();
url = json['url'];
created = json['created'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['status'] = this.status;
data['species'] = this.species;
data['type'] = this.type;
data['gender'] = this.gender;
if (this.origin != null) {
data['origin'] = this.origin!.toJson();
}
if (this.location != null) {
data['location'] = this.location!.toJson();
}
data['image'] = this.image;
data['episode'] = this.episode;
data['url'] = this.url;
data['created'] = this.created;
return data;
}
}
class Origin {
String? name;
String? url;
Origin({this.name, this.url});
Origin.fromJson(Map<String, dynamic> json) {
name = json['name'];
url = json['url'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['url'] = this.url;
return data;
}
}
xxxxxxxxxx
class BannersModel {
bool? status;
List<Banners>? banners;
BannersModel({this.status, this.banners});
BannersModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
if (json['banners'] != null) {
banners = <Banners>[];
json['banners'].forEach((v) {
banners!.add(new Banners.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
if (this.banners != null) {
data['banners'] = this.banners!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Banners {
String? id;
String? image;
Banners({this.id, this.image});
Banners.fromJson(Map<String, dynamic> json) {
id = json['id'];
image = json['image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['image'] = this.image;
return data;
}
}
xxxxxxxxxx
class Model {
String? name;
Model({this.name});
Model.fromJson(Map<String, dynamic> json) {
name = json['Name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Name'] = this.name;
return data;
}
}
xxxxxxxxxx
import 'dart:convert';
void main() {
String jsonStr = '{"name": "John", "age": 30}'; // Example JSON data
Map<String, dynamic> jsonMap = jsonDecode(jsonStr); // Parse JSON string to a map
Person person = Person.fromJson(jsonMap); // Convert the map to a Dart class object
print(person.name); // Access the object's properties
print(person.age);
}
class Person {
String name;
int age;
Person({this.name, this.age});
// Factory method to create a Person object from a map
factory Person.fromJson(Map<String, dynamic> json) {
return Person(
name: json['name'],
age: json['age'],
);
}
}
xxxxxxxxxx
// [{
// "source": {
// "id": null,
// "name": "Lifehacker.com"
// },
// "author": "Khamosh Pathak",
// "title": "The Best Prime Day Deals on Laptops",
// "description": "Amazon’s Prime Day sale is upon us, and there are quite a lot of laptop bargains to go around, from everyday college laptops, to MacBooks, and even high-end gaming machines. If you are in the market for a laptop, or were planning to buy one soon, this is a gr…",
// "url": "https://lifehacker.com/the-best-prime-day-deals-on-laptops-1850627675",
// "urlToImage": "https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/8871e886aadcc852f7d15318ac57bef8.jpg",
// "publishedAt": "2023-07-11T22:15:00Z",
// "content": "Amazons Prime Day sale is upon us, and there are quite a lot of laptop bargains to go around, from everyday college laptops, to MacBooks, and even high-end gaming machines. If you are in the market f… [+3211 chars]"
// }]
class NewsModel {
Source? source;
String? author;
String? title;
String? description;
String? url;
String? urlToImage;
String? publishedAt;
String? content;
NewsModel(
{this.source,
this.author,
this.title,
this.description,
this.url,
this.urlToImage,
this.publishedAt,
this.content});
NewsModel.fromJson(Map<String, dynamic> json) {
source =
json['source'] != null ? new Source.fromJson(json['source']) : null;
author = json['author'];
title = json['title'];
description = json['description'];
url = json['url'];
urlToImage = json['urlToImage'];
publishedAt = json['publishedAt'];
content = json['content'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.source != null) {
data['source'] = this.source!.toJson();
}
data['author'] = this.author;
data['title'] = this.title;
data['description'] = this.description;
data['url'] = this.url;
data['urlToImage'] = this.urlToImage;
data['publishedAt'] = this.publishedAt;
data['content'] = this.content;
return data;
}
}
class Source {
Null? id;
String? name;
Source({this.id, this.name});
Source.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
xxxxxxxxxx
class franchiserequest {
String? responseCode;
String? responseMessage;
List<GetRequests>? getRequests;
franchiserequest({this.responseCode, this.responseMessage, this.getRequests});
franchiserequest.fromJson(Map<String, dynamic> json) {
responseCode = json['response_code'];
responseMessage = json['response_message'];
if (json['get_Requests'] != null) {
getRequests = <GetRequests>[];
json['get_Requests'].forEach((v) {
getRequests!.add(new GetRequests.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['response_code'] = this.responseCode;
data['response_message'] = this.responseMessage;
if (this.getRequests != null) {
data['get_Requests'] = this.getRequests!.map((v) => v.toJson()).toList();
}
return data;
}
}
class GetRequests {
String? tRANSACTIONID;
String? lOCATIONCODE;
String? aCTION;
String? rEQUESTTYPE;
String? aPIMETHOD;
BODY? bODY;
String? rESPONSE;
String? rEQUESTSTATUS;
GetRequests(
{this.tRANSACTIONID,
this.lOCATIONCODE,
this.aCTION,
this.rEQUESTTYPE,
this.aPIMETHOD,
this.bODY,
this.rESPONSE,
this.rEQUESTSTATUS});
GetRequests.fromJson(Map<String, dynamic> json) {
tRANSACTIONID = json['TRANSACTION_ID'];
lOCATIONCODE = json['LOCATION_CODE'];
aCTION = json['ACTION'];
rEQUESTTYPE = json['REQUEST_TYPE'];
aPIMETHOD = json['API_METHOD'];
bODY = json['BODY'] != null ? new BODY.fromJson(json['BODY']) : null;
rESPONSE = json['RESPONSE'];
rEQUESTSTATUS = json['REQUEST_STATUS'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['TRANSACTION_ID'] = this.tRANSACTIONID;
data['LOCATION_CODE'] = this.lOCATIONCODE;
data['ACTION'] = this.aCTION;
data['REQUEST_TYPE'] = this.rEQUESTTYPE;
data['API_METHOD'] = this.aPIMETHOD;
if (this.bODY != null) {
data['BODY'] = this.bODY!.toJson();
}
data['RESPONSE'] = this.rESPONSE;
data['REQUEST_STATUS'] = this.rEQUESTSTATUS;
return data;
}
}
class BODY {
String? franchiseNumber;
String? ordertype;
List<String>? product;
String? cellNumber;
String? request;
BODY(
{this.franchiseNumber,
this.ordertype,
this.product,
this.cellNumber,
this.request});
BODY.fromJson(Map<String, dynamic> json) {
franchiseNumber = json['FranchiseNumber'];
ordertype = json['ordertype'];
product = json['product'].cast<String>();
cellNumber = json['CellNumber'];
request = json['request'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['FranchiseNumber'] = this.franchiseNumber;
data['ordertype'] = this.ordertype;
data['product'] = this.product;
data['CellNumber'] = this.cellNumber;
data['request'] = this.request;
return data;
}
}
xxxxxxxxxx
class Faclity {
String? responseCode;
String? responseMessage;
List<Facilities>? facilities;
Faclity({this.responseCode, this.responseMessage, this.facilities});
Faclity.fromJson(Map<String, dynamic> json) {
responseCode = json['ResponseCode'];
responseMessage = json['ResponseMessage'];
if (json['facilities'] != null) {
facilities = <Facilities>[];
json['facilities'].forEach((v) {
facilities!.add(new Facilities.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ResponseCode'] = this.responseCode;
data['ResponseMessage'] = this.responseMessage;
if (this.facilities != null) {
data['facilities'] = this.facilities!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Facilities {
String? faclityCode;
String? faclityDescription;
Facilities({this.faclityCode, this.faclityDescription});
Facilities.fromJson(Map<String, dynamic> json) {
faclityCode = json['FaclityCode'];
faclityDescription = json['FaclityDescription'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['FaclityCode'] = this.faclityCode;
data['FaclityDescription'] = this.faclityDescription;
return data;
}
}