Skip to content

Commit 09cf046

Browse files
committed
Small fixes
1 parent 4062477 commit 09cf046

File tree

10 files changed

+19
-131
lines changed

10 files changed

+19
-131
lines changed

pkgs/code_assets/lib/src/code_assets/validation.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Future<ValidationErrors> validateCodeAssetBuildOutput(
9191
output.assets.encodedAssets,
9292
[
9393
...output.assets.encodedAssetsForBuild,
94-
...output.assets.encodedAssetsForLinking.values.expand((l) => l),
94+
...output.assets.encodedAssetsForLinking.values.expand((assets) => assets),
9595
],
9696
output,
9797
true,
@@ -105,7 +105,7 @@ Future<ValidationErrors> validateCodeAssetLinkOutput(
105105
input,
106106
input.config.code,
107107
output.assets.encodedAssets,
108-
output.assets.encodedAssetsForLink.values.expand((l) => l),
108+
output.assets.encodedAssetsForLink.values.expand((assets) => assets),
109109
output,
110110
false,
111111
);

pkgs/hooks/lib/hooks.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export 'src/config.dart'
5353
LinkOutputBuilder,
5454
LinkOutputFailure,
5555
LinkOutputMaybeFailure,
56+
LinkOutputMetadataBuilder,
5657
PackageMetadata,
5758
ToAppBundle,
5859
ToBuildHooks,

pkgs/hooks/lib/src/config.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,12 @@ final class LinkInput extends HookInput {
354354
LinkInputAssets get assets => LinkInputAssets._(this);
355355

356356
/// The metadata set to this link hook by dependent link hooks.
357-
List<MetadataAsset> get metadata => assets.encodedInternalAssets
358-
.where((e) => e.isMetadataAsset)
359-
.map((e) => e.asMetadataAsset)
360-
.toList();
357+
Map<String, Object?> get metadata => Map.fromEntries(
358+
assets.assetsFromLinking
359+
.where((e) => e.isMetadataAsset)
360+
.map((e) => e.asMetadataAsset)
361+
.map((e) => MapEntry(e.key, e.value)),
362+
);
361363
}
362364

363365
/// The assets in [LinkInput.assets];
@@ -371,7 +373,7 @@ final class LinkInputAssets {
371373
EncodedAssetSyntax._fromSyntax(_input._syntaxLinkInput.assets);
372374

373375
/// The encoded assets from direct dependencies.
374-
List<EncodedAsset> get encodedInternalAssets =>
376+
List<EncodedAsset> get assetsFromLinking =>
375377
EncodedAssetSyntax._fromSyntax(_input._syntaxLinkInput.assetsFromLinking);
376378
}
377379

@@ -626,7 +628,7 @@ final class BuildOutputMetadataBuilder {
626628
}
627629
}
628630

629-
/// The builder for [BuildOutputBuilder.metadata].
631+
/// The builder for [LinkOutputBuilder.metadata].
630632
final class LinkOutputMetadataBuilder {
631633
final LinkOutputBuilder _output;
632634

pkgs/hooks_runner/lib/src/build_runner/build_runner.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class NativeAssetsBuildRunner {
266266
}
267267
var linkResult = hookResultUserDefines.success;
268268

269-
/// Key is packageName.
269+
/// The key is the package name of the destination package.
270270
final globalAssetsForBuild = <String, Map<String, List<EncodedAsset>>>{};
271271
for (final package in buildPlan) {
272272
final dependencies = packageGraph!
Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1 @@
1-
<!--
2-
This README describes the package. If you publish this package to pub.dev,
3-
this README's contents appear on the landing page for your package.
4-
5-
For information about how to write a good package README, see the guide for
6-
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
7-
8-
For general information about developing packages, see the Dart guide for
9-
[creating packages](https://dart.dev/guides/libraries/create-packages)
10-
and the Flutter guide for
11-
[developing packages and plugins](https://flutter.dev/to/develop-packages).
12-
-->
13-
14-
TODO: Put a short description of the package here that helps potential users
15-
know whether this package might be useful for them.
16-
17-
## Features
18-
19-
TODO: List what your package can do. Maybe include images, gifs, or videos.
20-
21-
## Getting started
22-
23-
TODO: List prerequisites and provide or point to information on how to
24-
start using the package.
25-
26-
## Usage
27-
28-
TODO: Include short and useful examples for package users. Add longer examples
29-
to `/example` folder.
30-
31-
```dart
32-
const like = 'sample';
33-
```
34-
35-
## Additional information
36-
37-
TODO: Tell users more about the package: where to find more information, how to
38-
contribute to the package, how to file issues, what response they can expect
39-
from the package authors, and more.
1+
A package with a high-level API to load a single flag.

pkgs/hooks_runner/test_data/flag_enthusiast_1/pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: flag_enthusiast_1
2-
description: Add and retrieve a data asset.
3-
2+
description: A package with a high-level API to load a single flag.
43

54
publish_to: none
65

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1 @@
1-
<!--
2-
This README describes the package. If you publish this package to pub.dev,
3-
this README's contents appear on the landing page for your package.
4-
5-
For information about how to write a good package README, see the guide for
6-
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
7-
8-
For general information about developing packages, see the Dart guide for
9-
[creating packages](https://dart.dev/guides/libraries/create-packages)
10-
and the Flutter guide for
11-
[developing packages and plugins](https://flutter.dev/to/develop-packages).
12-
-->
13-
14-
TODO: Put a short description of the package here that helps potential users
15-
know whether this package might be useful for them.
16-
17-
## Features
18-
19-
TODO: List what your package can do. Maybe include images, gifs, or videos.
20-
21-
## Getting started
22-
23-
TODO: List prerequisites and provide or point to information on how to
24-
start using the package.
25-
26-
## Usage
27-
28-
TODO: Include short and useful examples for package users. Add longer examples
29-
to `/example` folder.
30-
31-
```dart
32-
const like = 'sample';
33-
```
34-
35-
## Additional information
36-
37-
TODO: Tell users more about the package: where to find more information, how to
38-
contribute to the package, how to file issues, what response they can expect
39-
from the package authors, and more.
1+
A package with a high-level API to load multiple flags.

pkgs/hooks_runner/test_data/flag_enthusiast_2/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: flag_enthusiast_2
2-
description: Add and retrieve a data asset.
2+
description: A package with a high-level API to load multiple flags.
33

44
publish_to: none
55

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1 @@
1-
<!--
2-
This README describes the package. If you publish this package to pub.dev,
3-
this README's contents appear on the landing page for your package.
4-
5-
For information about how to write a good package README, see the guide for
6-
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
7-
8-
For general information about developing packages, see the Dart guide for
9-
[creating packages](https://dart.dev/guides/libraries/create-packages)
10-
and the Flutter guide for
11-
[developing packages and plugins](https://flutter.dev/to/develop-packages).
12-
-->
13-
14-
TODO: Put a short description of the package here that helps potential users
15-
know whether this package might be useful for them.
16-
17-
## Features
18-
19-
TODO: List what your package can do. Maybe include images, gifs, or videos.
20-
21-
## Getting started
22-
23-
TODO: List prerequisites and provide or point to information on how to
24-
start using the package.
25-
26-
## Usage
27-
28-
TODO: Include short and useful examples for package users. Add longer examples
29-
to `/example` folder.
30-
31-
```dart
32-
const like = 'sample';
33-
```
34-
35-
## Additional information
36-
37-
TODO: Tell users more about the package: where to find more information, how to
38-
contribute to the package, how to file issues, what response they can expect
39-
from the package authors, and more.
1+
A package bundling flag txt files, with a low-level API to load the flags.

pkgs/hooks_runner/test_data/fun_with_flags/hook/link.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import 'package:hooks/hooks.dart';
99
void main(List<String> args) {
1010
link(args, (input, output) async {
1111
print('Metadata: ${input.metadata}');
12-
final usedFlags = input.metadata
13-
.where((asset) => asset.key.startsWith(prefix))
12+
final usedFlags = input.metadata.entries
13+
.where((entry) => entry.key.startsWith(prefix))
1414
.expand((e) => e.value as List)
1515
.map((e) => e as String)
1616
.map((country) => 'package:fun_with_flags/assets/$country.txt')

0 commit comments

Comments
 (0)