javiercbk / json_to_dart

Library that generates dart classes from json strings
https://javiercbk.github.io/json_to_dart/
The Unlicense
1.32k stars 371 forks source link

Missing Parameter type for 'v', #75

Open Sanjay0907 opened 2 years ago

Sanjay0907 commented 2 years ago

Here is my code

In line 8, I am getting the error " Missing Parameter type 'v' "

`class Delivery_Valets { List? result; int? totalCount;

Delivery_Valets({this.result, this.totalCount});

Delivery_Valets.fromJson(Map<String, dynamic> json) { if (json['result'] != null) { result = []; json['result'].forEach((v) { result!.add(new Result.fromJson(v)); }); } totalCount = json['totalCount']; }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.result != null) { data['result'] = this.result!.map((v) => v.toJson()).toList(); } data['totalCount'] = this.totalCount; return data; } }

class Result { String? sId; int? phoneNumber; int? iV; String? accountStatus; String? accountType; List? addresses; String? createdAt; Location? location; String? updatedAt; String? userType; Verification? verification; String? email; String? gender; String? name; Null? profileImageUrl; String? vehicleType;

Result( {this.sId, this.phoneNumber, this.iV, this.accountStatus, this.accountType, this.addresses, this.createdAt, this.location, this.updatedAt, this.userType, this.verification, this.email, this.gender, this.name, this.profileImageUrl, this.vehicleType});

Result.fromJson(Map<String, dynamic> json) { sId = json['_id']; phoneNumber = json['phoneNumber']; iV = json['__v']; accountStatus = json['accountStatus']; accountType = json['accountType']; if (json['addresses'] != null) { addresses = []; json['addresses'].forEach((v) { addresses!.add(new Addresses.fromJson(v)); }); } createdAt = json['createdAt']; location = json['location'] != null ? new Location.fromJson(json['location']) : null; updatedAt = json['updatedAt']; userType = json['userType']; verification = json['verification'] != null ? new Verification.fromJson(json['verification']) : null; email = json['email']; gender = json['gender']; name = json['name']; profileImageUrl = json['profileImageUrl']; vehicleType = json['vehicleType']; }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['_id'] = this.sId; data['phoneNumber'] = this.phoneNumber; data['__v'] = this.iV; data['accountStatus'] = this.accountStatus; data['accountType'] = this.accountType; if (this.addresses != null) { data['addresses'] = this.addresses!.map((v) => v.toJson()).toList(); } data['createdAt'] = this.createdAt; if (this.location != null) { data['location'] = this.location!.toJson(); } data['updatedAt'] = this.updatedAt; data['userType'] = this.userType; if (this.verification != null) { data['verification'] = this.verification!.toJson(); } data['email'] = this.email; data['gender'] = this.gender; data['name'] = this.name; data['profileImageUrl'] = this.profileImageUrl; data['vehicleType'] = this.vehicleType; return data; } }

class Addresses { String? name; Location? location; String? type; String? address; String? landMark; String? sId;

Addresses( {this.name, this.location, this.type, this.address, this.landMark, this.sId});

Addresses.fromJson(Map<String, dynamic> json) { name = json['name']; location = json['location'] != null ? new Location.fromJson(json['location']) : null; type = json['type']; address = json['address']; landMark = json['landMark']; sId = json['_id']; }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['name'] = this.name; if (this.location != null) { data['location'] = this.location!.toJson(); } data['type'] = this.type; data['address'] = this.address; data['landMark'] = this.landMark; data['_id'] = this.sId; return data; } }

class Location { String? type; List? coordinates;

Location({this.type, this.coordinates});

Location.fromJson(Map<String, dynamic> json) { type = json['type']; coordinates = json['coordinates'].cast(); }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['type'] = this.type; data['coordinates'] = this.coordinates; return data; } }

class Verification { Phone? phone; Aadhar? aadhar; BankDetails? bankDetails; Aadhar? drivingLicense; Aadhar? pancard; VehicleNumber? vehicleNumber; Aadhar? vehicleRC;

Verification( {this.phone, this.aadhar, this.bankDetails, this.drivingLicense, this.pancard, this.vehicleNumber, this.vehicleRC});

Verification.fromJson(Map<String, dynamic> json) { phone = json['phone'] != null ? new Phone.fromJson(json['phone']) : null; aadhar = json['aadhar'] != null ? new Aadhar.fromJson(json['aadhar']) : null; bankDetails = json['bankDetails'] != null ? new BankDetails.fromJson(json['bankDetails']) : null; drivingLicense = json['drivingLicense'] != null ? new Aadhar.fromJson(json['drivingLicense']) : null; pancard = json['pancard'] != null ? new Aadhar.fromJson(json['pancard']) : null; vehicleNumber = json['vehicleNumber'] != null ? new VehicleNumber.fromJson(json['vehicleNumber']) : null; vehicleRC = json['vehicleRC'] != null ? new Aadhar.fromJson(json['vehicleRC']) : null; }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.phone != null) { data['phone'] = this.phone!.toJson(); } if (this.aadhar != null) { data['aadhar'] = this.aadhar!.toJson(); } if (this.bankDetails != null) { data['bankDetails'] = this.bankDetails!.toJson(); } if (this.drivingLicense != null) { data['drivingLicense'] = this.drivingLicense!.toJson(); } if (this.pancard != null) { data['pancard'] = this.pancard!.toJson(); } if (this.vehicleNumber != null) { data['vehicleNumber'] = this.vehicleNumber!.toJson(); } if (this.vehicleRC != null) { data['vehicleRC'] = this.vehicleRC!.toJson(); } return data; } }

class Phone { bool? isVerified; Otp? otp;

Phone({this.isVerified, this.otp});

Phone.fromJson(Map<String, dynamic> json) { isVerified = json['isVerified']; otp = json['otp'] != null ? new Otp.fromJson(json['otp']) : null; }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['isVerified'] = this.isVerified; if (this.otp != null) { data['otp'] = this.otp!.toJson(); } return data; } }

class Otp { String? expiresAt; bool? isOtpSent; String? sentAt; int? value;

Otp({this.expiresAt, this.isOtpSent, this.sentAt, this.value});

Otp.fromJson(Map<String, dynamic> json) { expiresAt = json['ExpiresAt']; isOtpSent = json['isOtpSent']; sentAt = json['sentAt']; value = json['value']; }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['ExpiresAt'] = this.expiresAt; data['isOtpSent'] = this.isOtpSent; data['sentAt'] = this.sentAt; data['value'] = this.value; return data; } }

class Aadhar { String? url; String? value;

Aadhar({this.url, this.value});

Aadhar.fromJson(Map<String, dynamic> json) { url = json['url']; value = json['value']; }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['url'] = this.url; data['value'] = this.value; return data; } }

class BankDetails { String? bankIFSC; String? bankName; String? url; String? value;

BankDetails({this.bankIFSC, this.bankName, this.url, this.value});

BankDetails.fromJson(Map<String, dynamic> json) { bankIFSC = json['bankIFSC']; bankName = json['bankName']; url = json['url']; value = json['value']; }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['bankIFSC'] = this.bankIFSC; data['bankName'] = this.bankName; data['url'] = this.url; data['value'] = this.value; return data; } }

class VehicleNumber { String? value;

VehicleNumber({this.value});

VehicleNumber.fromJson(Map<String, dynamic> json) { value = json['value']; }

Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['value'] = this.value; return data; } } `

2lineofcode commented 7 months ago

hi ~ i fix almost all issue on here, and rewrite this tool, try my version https://2lineofcode.github.io/json_to_dart2023