path property

String path
final

The path to the content file to be embedded.

If path is a relative path, it is treated as relative to the parent directory of the source file where the annotation is defined. Otherwise, if it is an absolute path, it is treated as relative to the package root directory.

For example, the following annotation tells the code generator that the specified content file exists in package_root/lib/file_to_embed.json.

// package_root/lib/example.dart
@EmbedStr('../pubspec.yaml')
const pubspec = _$pubspec;

Using the absolute path, the above example can be rewritten as follows:

@EmbedStr('/pubspec.yaml')
const pubspec = _$pubspec;

Implementation

final String path;