sendVideoMessage method Null safety

Future<JMVideoMessage> sendVideoMessage(
  1. {required dynamic type,
  2. String? thumbImagePath,
  3. String? thumbFormat,
  4. required String? videoPath,
  5. String? videoFileName,
  6. int? duration,
  7. JMMessageSendOptions? sendOption,
  8. Map? extras}
)

Implementation

Future<JMVideoMessage> sendVideoMessage({
  required dynamic type,

  /// (JMSingle | JMGroup | JMChatRoom)
  String? thumbImagePath,
  String? thumbFormat,
  required String? videoPath,
  String? videoFileName,
  int? duration,
  JMMessageSendOptions? sendOption,
  Map<dynamic, dynamic>? extras,
}) async {
  Map param = type.toJson();
  Map optionMap = {};
  if (sendOption != null) {
    optionMap = {
      'messageSendingOptions': sendOption.toJson()
        ..removeWhere((key, value) => value == null)
    };
  }

  if (extras != null) {
    param..addAll({'extras': extras});
  }

  param
    ..addAll(optionMap)
    ..addAll({
      'thumbImagePath': thumbImagePath,
      'thumbFormat': thumbFormat,
      'videoPath': videoPath,
      'videoFileName': videoFileName,
      'duration': duration
    });

  Map resMap = await _channel.invokeMethod(
      'sendVideoMessage', param..removeWhere((key, value) => value == null));
  var res = JMNormalMessage.generateMessageFromJson(resMap);
  return res;
}