pickAssets method

Future<List<ExtendedAssetEntity>?> pickAssets(
  1. BuildContext context, {
  2. bool useRootNavigator = true,
  3. AssetPickerConfig? pickerConfig,
  4. AssetPickerPageRouteBuilder<List<AssetEntity>>? pageRouteBuilder,
})

选择图片

Implementation

Future<List<ExtendedAssetEntity>?> pickAssets(BuildContext context,
    {bool useRootNavigator = true,
    AssetPickerConfig? pickerConfig,
    AssetPickerPageRouteBuilder<List<AssetEntity>>? pageRouteBuilder}) async {
  final List<AssetEntity>? assets = await FlAssetsPicker.showPickerAssets(
      context,
      checkPermission: _assetsPicker.checkPermission,
      pickerConfig: pickerConfig ?? assetConfig,
      useRootNavigator: useRootNavigator,
      pageRouteBuilder: pageRouteBuilder);
  if (assets != null && assets.isNotEmpty) {
    List<ExtendedAssetEntity> list = [];
    for (var element in assets) {
      if (!allAssetEntity.contains(element)) {
        list.add(await element.toExtensionAssetEntity(
            renovate: _assetsPicker.renovate));
      }
    }
    return list;
  }
  return null;
}