StorageFile constructor

StorageFile({
  1. required String cloudPath,
  2. required String fileName,
  3. required int size,
  4. required StorageRef reference,
})

Implementation

StorageFile(
    {required this.cloudPath,
    required this.fileName,
    required this.size,
    required this.reference}) {
  List<String> names = cloudPath.split("/");
  if (names.length > 6) {
    relatedDirs = [];
    for (int i = 6; i < names.length - 1; i++) {
      relatedDirs.add(names[i]);
    }
  }
  extension = fileName.split(".").last.toUpperCase();
  if (imgExt.any((element) => element.toUpperCase() == extension)) {
    type = "image";
  } else if (vidExt.any((element) => element.toUpperCase() == extension)) {
    type = "video";
  } else {
    type = "file";
  }
}