assetActions property

  1. @override
List<AssetAction> get assetActions
override

What this module can do with a file in the Assets dock.

Implementation

@override
List<AssetAction> get assetActions => [
  AssetAction(
    id: 'asset_store.show',
    label: 'Show in the Asset Store',
    icon: Icons.storefront_rounded,
    appliesTo: (path, {required isDirectory}) =>
        isDirectory && RegExp(r'^packages/[a-z][a-z0-9_]*$').hasMatch(path),
    run: (scope, path) => scope.openWorkspace(
      workspaceId,
      path: 'store:${path.substring('packages/'.length)}',
    ),
  ),
  AssetAction(
    id: 'asset_store.get',
    label: 'Get assets from the store',
    icon: Icons.storefront_outlined,
    order: 140,
    appliesTo: (path, {required isDirectory}) =>
        isDirectory && path == 'assets',
    run: (scope, path) => scope.openWorkspace(workspaceId),
  ),
];