switchPath method

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

Switch between paths. 切换路径

Implementation

@override
Future<void> switchPath([PathWrapper<AssetPathEntity>? path]) async {
  assert(
    () {
      if (path == null && _currentPath == null) {
        throw FlutterError.fromParts(<DiagnosticsNode>[
          ErrorSummary('Switching empty path.'),
          ErrorDescription(
            'Neither "path" nor "currentPathEntity" is non-null, '
            'which makes this method useless.',
          ),
          ErrorHint(
            'You need to pass a non-null path or call this method '
            'when the "currentPath" is not null.',
          ),
        ]);
      }
      return true;
    }(),
  );
  if (path == null && _currentPath == null) {
    return;
  }
  path ??= _currentPath!;
  _currentPath = path;
  await getAssetsFromCurrentPath();
}