create static method

Audio create({
  1. bool schemeUtilsIsSetDefaultData = false,
  2. String special_type = "audio",
  3. String? url,
  4. String? mimetype,
  5. String? filesha256,
  6. String? filelength,
  7. num? seconds,
  8. bool? ptt,
  9. String? mediakey,
  10. String? fileencsha256,
  11. String? directpath,
  12. String? mediakeytimestamp,
  13. ContextInfo? contextinfo,
  14. String? waveform,
})
override

Generated

Implementation

static Audio create({
  bool schemeUtilsIsSetDefaultData = false,
  String special_type = "audio",
  String? url,
  String? mimetype,
  String? filesha256,
  String? filelength,
  num? seconds,
  bool? ptt,
  String? mediakey,
  String? fileencsha256,
  String? directpath,
  String? mediakeytimestamp,
  ContextInfo? contextinfo,
  String? waveform,
}) {
  // Audio audio = Audio({
  final Map audio_data_create_json = {
    "@type": special_type,
    "url": url,
    "mimetype": mimetype,
    "fileSha256": filesha256,
    "fileLength": filelength,
    "seconds": seconds,
    "ptt": ptt,
    "mediaKey": mediakey,
    "fileEncSha256": fileencsha256,
    "directPath": directpath,
    "mediaKeyTimestamp": mediakeytimestamp,
    "contextInfo": (contextinfo != null) ? contextinfo.toJson() : null,
    "waveform": waveform,
  };

  audio_data_create_json.removeWhere((key, value) => value == null);

  if (schemeUtilsIsSetDefaultData) {
    defaultData.forEach((key, value) {
      if (audio_data_create_json.containsKey(key) == false) {
        audio_data_create_json[key] = value;
      }
    });
  }
  return Audio(audio_data_create_json);
}