convertUrls static method

List<ExtendedAssetEntity> convertUrls(
  1. String url, {
  2. AssetType assetsType = AssetType.image,
  3. String? splitPattern,
})

url 地址转换 List

Implementation

static List<ExtendedAssetEntity> convertUrls(String url,
    {AssetType assetsType = AssetType.image, String? splitPattern}) {
  List<ExtendedAssetEntity> list = [];
  if (url.isEmpty) return list;
  if (splitPattern != null && url.contains(splitPattern)) {
    final urls = url.split(splitPattern);
    for (var element in urls) {
      if (element.isNotEmpty) {
        list.add(ExtendedAssetEntity.fromPreviewed(
            previewed: element, assetType: assetsType));
      }
    }
  } else {
    list.add(ExtendedAssetEntity.fromPreviewed(
        assetType: assetsType, previewed: url));
  }
  return list;
}