ModelGenerator class
Generates a Dart model class from a JSON string.
Constructors
- ModelGenerator.new(String jsonString, {String className = 'test', String output = 'output/models', bool toJson = false, bool fromJson = false})
- Creates a new instance of ModelGenerator.
Properties
- className → String
-
The name of the class to generate.
final
- fromJson → bool
-
Whether to include a
fromJson
factory constructor in the generated class.final - hashCode → int
-
The hash code for this object.
no setterinherited
- jsonString → String
-
The JSON string to convert to a model.
final
- output → String
-
The path to output the generated file.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- toJson → bool
-
Whether to include a
toJson
method in the generated class.final
Methods
-
generate(
) → void - Generates the model file.
-
jsonToModel(
) → String - Converts the JSON string to a Dart model.
-
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