JsonLiteral class Null safety
An annotation used to generate a private field containing the contents of a JSON file.
The annotation can be applied to any member, but usually it's applied to top-level getter.
In this example, the JSON content of data.json
is populated into a
top-level, final field _$glossaryDataJsonLiteral
in the generated file.
@JsonLiteral('data.json')
Map get glossaryData => _$glossaryDataJsonLiteral;
- Annotations
- @Target({TargetKind.getter})
Constructors
- JsonLiteral(String path, {bool asConst = false})
-
Creates a new JsonLiteral instance.
const
Properties
- asConst → bool
-
true
if the JSON literal should be written as a constant.final - hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- path → String
-
The relative path from the Dart file with the annotation to the file
containing the source JSON.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
A string representation of this object. [...]
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited