switchPath method

  1. @override
Future<void> switchPath([
  1. AssetPathEntity? pathEntity
])
override

Switch path entity. 切换路径

Implementation

@override
Future<void> switchPath([AssetPathEntity? pathEntity]) async {
  assert(() {
    if (_currentPathEntity == null && pathEntity == null) {
      throw FlutterError.fromParts(<DiagnosticsNode>[
        ErrorSummary('Empty $AssetPathEntity was switched.'),
        ErrorDescription(
          'Neither currentPathEntity nor pathEntity is non-null, which makes '
          'this method useless.',
        ),
        ErrorHint(
          'You need to pass a non-null $AssetPathEntity or call this method '
          'when currentPathEntity is not null.',
        ),
      ]);
    }
    return true;
  }());
  if (_currentPathEntity == null && pathEntity == null) {
    return;
  }
  pathEntity ??= _currentPathEntity!;
  _isSwitchingPath = false;
  _currentPathEntity = pathEntity;
  _totalAssetsCount = pathEntity.assetCount;
  if(mounted){
    notifyListeners();
  }
  await getAssetsFromEntity(0, currentPathEntity!);
}