packagesWithAssets method

Future<List<Package>> packagesWithAssets(
  1. Hook hook
)

All packages in packageConfig with native assets.

Whether a package has native assets is defined by whether it contains a hook/build.dart or hook/link.dart.

For backwards compatibility, a toplevel build.dart is also supported.

Implementation

// TODO(https://github.com/dart-lang/native/issues/823): Remove fallback when
// everyone has migrated. (Probably once we stop backwards compatibility of
// the protocol version pre 1.2.0 on some future version.)
Future<List<Package>> packagesWithAssets(Hook hook) async => switch (hook) {
      Hook.build => _packagesWithBuildAssets ??=
          await _packagesWithHook(hook),
      Hook.link => _packagesWithLinkAssets ??= await _packagesWithHook(hook),
    };