JsonFactoryBuilder class
Custom builder that generates a centralized JsonFactory class.
This builder scans the entire project for classes annotated with @jsonModel
and @JsonSerializable
, then generates a single JsonFactory class containing
all the necessary type mappings and factory functions.
The generated JsonFactory provides:
- Type-safe JSON parsing via
JsonFactory.fromJson<T>(json)
- Support for both single objects and lists (List
- Compile-time type checking
- No runtime initialization required
Configuration options:
output_path
: Directory where the factory file is generated (default: "lib")output_file_name
: Name of the generated file without extension (default: "json_factory")
Constructors
- JsonFactoryBuilder(BuilderOptions options)
Properties
-
buildExtensions
→ Map<
String, List< String> > -
Mapping from input file extension to output file extensions.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- options → BuilderOptions
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildStep buildStep) → Future< void> -
Generates the outputs for a given
BuildStep
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited