create static method

FileContent create(
  1. String msgType, {
  2. TransportableData? data,
  3. String? filename,
  4. Uri? url,
  5. DecryptKey? password,
})

Implementation

static FileContent create(String msgType, {
  TransportableData? data, String? filename,
  Uri? url, DecryptKey? password,
}) {
  if (msgType == ContentType.IMAGE) {
    return ImageFileContent.from(data, filename, url, password);
  } else if (msgType == ContentType.AUDIO) {
    return AudioFileContent.from(data, filename, url, password);
  } else if (msgType == ContentType.VIDEO) {
    return VideoFileContent.from(data, filename, url, password);
  }
  return BaseFileContent.from(msgType, data, filename, url, password);
}