Initial commit: Penyerahan final Source code Tugas Akhir
This commit is contained in:
54
lib/models/zero_price_model.dart
Normal file
54
lib/models/zero_price_model.dart
Normal file
@ -0,0 +1,54 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final zeroPrice = zeroPriceFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
ZeroPrice zeroPriceFromJson(String str) => ZeroPrice.fromJson(json.decode(str));
|
||||
|
||||
String zeroPriceToJson(ZeroPrice data) => json.encode(data.toJson());
|
||||
|
||||
class ZeroPrice {
|
||||
ZeroPrice({
|
||||
this.status,
|
||||
this.error,
|
||||
this.data,
|
||||
});
|
||||
|
||||
final int? status;
|
||||
final bool? error;
|
||||
List<Data>? data;
|
||||
|
||||
factory ZeroPrice.fromJson(Map<String, dynamic> json) => ZeroPrice(
|
||||
status: json["status"],
|
||||
error: json["error"],
|
||||
data: List<Data>.from(json["data"]
|
||||
.map((x) => List<Data>.from(x.map((x) => Data.fromJson(x))))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"status": status,
|
||||
"error": error,
|
||||
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class Data {
|
||||
Data({
|
||||
this.orderId,
|
||||
this.grossAmount,
|
||||
});
|
||||
|
||||
final String? orderId;
|
||||
final String? grossAmount;
|
||||
|
||||
factory Data.fromJson(Map<String, dynamic> json) => Data(
|
||||
orderId: json["order_id"],
|
||||
grossAmount: json["gross_amount"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"order_id": orderId,
|
||||
"gross_amount": grossAmount,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user