response method Null safety

  1. @override
Future<BaseMessage> response(
  1. Map<String, dynamic> res
)
override

Implementation

@override
Future<BaseMessage> response(res) async {
  var sortedMetaarrayList = [];
  if (res['sorted_metaarray'].isNotEmpty) {
    sortedMetaarrayList.add(res['sorted_metaarray']);
  }
  res['sorted_metaarray'] = sortedMetaarrayList;

  if (res['scheduled_message_id'] == null ||
      res['scheduled_status'] == null ||
      res['scheduled_at'] == null) {
    throw SBError(message: 'Scheduled Message Info Not Found');
  }
  res['scheduled_info'] = {
    'scheduled_message_id': res['scheduled_message_id'],
    'scheduled_status': res['scheduled_status'],
    'scheduled_at': res['scheduled_at'],
  };

  return BaseMessage.fromJson(res);
}