BmScanResponse.fromMap constructor

BmScanResponse.fromMap(
  1. Map json
)

Implementation

factory BmScanResponse.fromMap(Map<dynamic, dynamic> json) {
  List<BmScanAdvertisement> advertisements = [];
  for (var item in json['advertisements']) {
    advertisements.add(BmScanAdvertisement.fromMap(item));
  }

  bool success = json['success'] == null || json['success'] != 0;

  return BmScanResponse(
    advertisements: advertisements,
    success: success,
    errorCode: !success ? json['error_code'] : 0,
    errorString: !success ? json['error_string'] : "",
  );
}