currentPath property

AssetPathEntity? currentPath
inherited

The path which is currently using. 正在查看的资源路径

Implementation

Path? get currentPath => _currentPath;
  1. @override
void currentPath=(AssetPathEntity? value)
override

Implementation

@override
set currentPath(AssetPathEntity? value) {
  if (value == _currentPath) {
    return;
  }
  _currentPath = value;
  if (value != null &&
      _pathsList.keys.any((AssetPathEntity p) => p.id == value.id)) {
    final AssetPathEntity previous = _pathsList.keys.singleWhere(
      (AssetPathEntity p) => p.id == value.id,
    );
    final int index = _pathsList.keys.toList().indexOf(previous);
    final List<MapEntry<AssetPathEntity, Uint8List?>> newEntries =
        _pathsList.entries.toList()
          ..removeAt(index)
          ..insert(index, MapEntry<AssetPathEntity, Uint8List?>(value, null));
    _pathsList
      ..clear()
      ..addEntries(newEntries);
    getThumbnailFromPath(value);
  }
  notifyListeners();
}