refreshAndSelectEntity static method

Future<void> refreshAndSelectEntity(
  1. BuildContext context,
  2. AssetEntity? entity
)

Implementation

static Future<void> refreshAndSelectEntity(
  BuildContext context,
  AssetEntity? entity,
) async {
  if (entity == null) {
    return;
  }
  final AssetPicker<AssetEntity, AssetPathEntity> picker =
      context.findAncestorWidgetOfExactType()!;
  final DefaultAssetPickerBuilderDelegate builder =
      picker.builder as DefaultAssetPickerBuilderDelegate;
  final DefaultAssetPickerProvider p = builder.provider;
  await p.switchPath(
    PathWrapper<AssetPathEntity>(
      path: await p.currentPath!.path.obtainForNewProperties(),
    ),
  );
  builder.viewAsset(context, 0, entity);
}