toListModel<MT extends StorageModel> method

List<MT> toListModel<MT extends StorageModel>([
  1. String? type
])

Implementation

List<MT> toListModel<MT extends StorageModel>([String? type]) {
  if (this is List) {
    return (this as List).map((e) => e.toModel<MT>(type)).toList()
        as List<MT>;
  } else if (this is Map) {
    return (this as Map).values
        .map((e) => (e as Object).toModel<MT>(type))
        .toList();
  } else {
    throw StorageDatabaseException('Data is not a List or Map');
  }
}