Skip to content

Commit

Permalink
Update annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Oct 18, 2023
1 parent 88b8ff4 commit 942803e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 40 deletions.
12 changes: 3 additions & 9 deletions pkgs/asset_bundle/lib/src/resources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,19 @@ class Resources {

class Identifier {
final String name;
final String id;
final String uri;
final bool nonConstant;
final List<ResourceFile> files;

Identifier({
required this.name,
required this.id,
required this.uri,
required this.nonConstant,
required this.files,
});

Map<String, dynamic> toJson() {
return {
'name': name,
'uri': uri,
'nonConstant': nonConstant,
'files': files.map((x) => x.toJson()).toList(),
};
}

@override
String toString() {
return 'Identifier(name: $name, uri: $uri, nonConstant: $nonConstant, files: $files)';
Expand All @@ -45,6 +38,7 @@ class Identifier {
factory Identifier.fromJson(Map<String, dynamic> map) {
return Identifier(
name: map['name'] ?? '',
id: map['id'] ?? '',
uri: map['uri'] ?? '',
nonConstant: map['nonConstant'] ?? false,
files: List<ResourceFile>.from(
Expand Down
Binary file removed pkgs/messages/example_json/bin/example.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion pkgs/messages/example_json/lib/testarbctx2.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AboutPageMessages {
);
}

@pragma('resource-identifier')
@Resource('messages')
@pragma('dart2js:resource-identifier')
@pragma('dart2js:never-inline')
static Future<String> generate(MessagesAssetBundle bundle, List args,
Expand Down
3 changes: 2 additions & 1 deletion pkgs/messages/example_json/link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ void main(List<String> args) {

final resources = Resources.fromString(input);
final ourIdentifiers = resources.identifiers
.where((identifier) => identifier.name == 'generate');
.where((identifier) => identifier.name == 'generate')
.where((identifier) => identifier.id.startsWith('messages'));
final entries = ourIdentifiers
.expand((identifier) => identifier.files)
.expand((file) => file.references.map((reference) {
Expand Down
29 changes: 0 additions & 29 deletions pkgs/messages/example_json/resources_vm.json

This file was deleted.

0 comments on commit 942803e

Please sign in to comment.