2021-01-05 09:41:32 +00:00
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
class BillingPlan {
|
|
|
|
final String id;
|
2021-01-06 08:47:18 +00:00
|
|
|
final String androidID;
|
|
|
|
final String iosID;
|
|
|
|
final int storageInMBs;
|
2021-01-05 09:41:32 +00:00
|
|
|
final String price;
|
2021-01-06 08:47:18 +00:00
|
|
|
final String period;
|
2021-01-05 09:41:32 +00:00
|
|
|
|
|
|
|
BillingPlan({
|
|
|
|
this.id,
|
2021-01-06 08:47:18 +00:00
|
|
|
this.androidID,
|
|
|
|
this.iosID,
|
|
|
|
this.storageInMBs,
|
2021-01-05 09:41:32 +00:00
|
|
|
this.price,
|
2021-01-06 08:47:18 +00:00
|
|
|
this.period,
|
2021-01-05 09:41:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
BillingPlan copyWith({
|
|
|
|
String id,
|
2021-01-06 08:47:18 +00:00
|
|
|
String androidID,
|
|
|
|
String iosID,
|
|
|
|
int storageInMBs,
|
2021-01-05 09:41:32 +00:00
|
|
|
String price,
|
2021-01-06 08:47:18 +00:00
|
|
|
String period,
|
2021-01-05 09:41:32 +00:00
|
|
|
}) {
|
|
|
|
return BillingPlan(
|
|
|
|
id: id ?? this.id,
|
2021-01-06 08:47:18 +00:00
|
|
|
androidID: androidID ?? this.androidID,
|
|
|
|
iosID: iosID ?? this.iosID,
|
|
|
|
storageInMBs: storageInMBs ?? this.storageInMBs,
|
2021-01-05 09:41:32 +00:00
|
|
|
price: price ?? this.price,
|
2021-01-06 08:47:18 +00:00
|
|
|
period: period ?? this.period,
|
2021-01-05 09:41:32 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, dynamic> toMap() {
|
|
|
|
return {
|
|
|
|
'id': id,
|
2021-01-06 08:47:18 +00:00
|
|
|
'androidID': androidID,
|
|
|
|
'iosID': iosID,
|
|
|
|
'storageInMBs': storageInMBs,
|
2021-01-05 09:41:32 +00:00
|
|
|
'price': price,
|
2021-01-06 08:47:18 +00:00
|
|
|
'period': period,
|
2021-01-05 09:41:32 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
factory BillingPlan.fromMap(Map<String, dynamic> map) {
|
|
|
|
if (map == null) return null;
|
|
|
|
|
|
|
|
return BillingPlan(
|
|
|
|
id: map['id'],
|
2021-01-06 08:47:18 +00:00
|
|
|
androidID: map['androidID'],
|
|
|
|
iosID: map['iosID'],
|
|
|
|
storageInMBs: map['storageInMBs'],
|
2021-01-05 09:41:32 +00:00
|
|
|
price: map['price'],
|
2021-01-06 08:47:18 +00:00
|
|
|
period: map['period'],
|
2021-01-05 09:41:32 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
|
|
|
|
factory BillingPlan.fromJson(String source) =>
|
|
|
|
BillingPlan.fromMap(json.decode(source));
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
2021-01-06 08:47:18 +00:00
|
|
|
return 'BillingPlan(id: $id, androidID: $androidID, iosID: $iosID, storageInMBs: $storageInMBs, price: $price, period: $period)';
|
2021-01-05 09:41:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool operator ==(Object o) {
|
|
|
|
if (identical(this, o)) return true;
|
|
|
|
|
|
|
|
return o is BillingPlan &&
|
|
|
|
o.id == id &&
|
2021-01-06 08:47:18 +00:00
|
|
|
o.androidID == androidID &&
|
|
|
|
o.iosID == iosID &&
|
|
|
|
o.storageInMBs == storageInMBs &&
|
2021-01-05 09:41:32 +00:00
|
|
|
o.price == price &&
|
2021-01-06 08:47:18 +00:00
|
|
|
o.period == period;
|
2021-01-05 09:41:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode {
|
2021-01-06 08:47:18 +00:00
|
|
|
return id.hashCode ^
|
|
|
|
androidID.hashCode ^
|
|
|
|
iosID.hashCode ^
|
|
|
|
storageInMBs.hashCode ^
|
|
|
|
price.hashCode ^
|
|
|
|
period.hashCode;
|
2021-01-05 09:41:32 +00:00
|
|
|
}
|
|
|
|
}
|