send method Null safety

Future<Response> send(
  1. {required String message,
  2. required List<String> to,
  3. String? from,
  4. int? bulkSMSMode,
  5. int? enqueue,
  6. String? keyword,
  7. String? linkId,
  8. int? retryDurationInHours}
)

Sends message

Requires; message (message to be send) to (a list of recipient's phone numbers)

when from is provided, it will override shortCode

Implementation

Future<http.Response> send({
  required String message,
  required List<String>to,
  String? from,

  // optionals
  int? bulkSMSMode, int? enqueue, String? keyword, String? linkId, int? retryDurationInHours
})async{
  return await africasTalking.httpPostProcess(
    africasTalking.isLive ? smsLiveUrl : smsTestUrl,
    {
      'from': (from ?? shortCode).toString(),
      'to': to.join(','),
      'message': message,
      if(bulkSMSMode != null) ...{'bulkSMSMode': bulkSMSMode},
      if(enqueue != null) ...{'enqueue': enqueue},
      if(keyword != null) ...{'keyword': keyword},
      if(linkId != null) ...{'linkId': linkId},
      if(retryDurationInHours != null) ...{'retryDurationInHours': retryDurationInHours},
    }
  );

}