KonectarEvents/lib/contacts_module/model_class/location_model.dart

52 lines
1.1 KiB
Dart

// To parse this JSON data, do
//
// final loc = locFromJson(jsonString);
import 'dart:convert';
List<Loc> locFromJson(String str) =>
List<Loc>.from(json.decode(str).map((x) => Loc.fromJson(x)));
String locToJson(List<Loc> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class Loc {
int id;
int userId;
String institution;
String address;
String city;
String state;
int postalCode;
Loc({
required this.id,
required this.userId,
required this.institution,
required this.address,
required this.city,
required this.state,
required this.postalCode,
});
factory Loc.fromJson(Map<String, dynamic> json) => Loc(
id: json["id"],
userId: json["user_id"],
institution: json["Institution"],
address: json["Address"],
city: json["City"],
state: json["State"],
postalCode: json["Postal_code"],
);
Map<String, dynamic> toJson() => {
"id": id,
"user_id": userId,
"Institution": institution,
"Address": address,
"City": city,
"State": state,
"Postal_code": postalCode,
};
}