GeneratorConfig class
The configuration that the Generator uses
Constructors
-
GeneratorConfig.new({required String name, required String outputDirectory, ProgrammingLanguage language = ProgrammingLanguage.dart, JsonSerializer jsonSerializer = JsonSerializer.jsonSerializable, String defaultContentType = 'application/json', bool rootClient = true, bool extrasParameterByDefault = false, bool dioOptionsParameterByDefault = false, String? rootClientName = 'RestClient', String? clientPostfix, bool exportFile = true, bool putClientsInFolder = false, bool enumsToJson = false, bool unknownEnumValue = true, bool markFilesAsGenerated = false, bool originalHttpResponse = false, List<
ReplacementRule> replacementRules = const [], bool generateValidator = false, bool useFreezed3 = false, bool useMultipartFile = false, String? fallbackUnion}) -
Creates a GeneratorConfig.
const
Properties
- clientPostfix → String?
-
Optional. Set postfix for client classes and files.
final
- defaultContentType → String
-
DART ONLY
Default content type for all requests and responses.
final
- dioOptionsParameterByDefault → bool
-
DART ONLY
Add dio options parameter to all requests.
final
- enumsToJson → bool
-
DART ONLY
Optional. Set
true
to include toJson() in enums. If set tofalse
, serialization will use .name instead.final - exportFile → bool
-
DART ONLY
Optional. Set
true
to generate export file.final - extrasParameterByDefault → bool
-
DART ONLY
Add extra parameter to all requests. Supported after retrofit 4.1.0.
final
- fallbackUnion → String?
-
DART ONLY
Optional. Set fallback consctructor name to use fallbackUnion parameter when using Freezed annotation.
final
- generateValidator → bool
-
Optional. Set
true
to generate validator function and prams for freezed.final - hashCode → int
-
The hash code for this object.
no setterinherited
- jsonSerializer → JsonSerializer
-
DART ONLY
Optional. Current available serializers are: json_serializable, freezed, dart_mappable.
final
- language → ProgrammingLanguage
-
Optional. Sets the programming language.
Current available languages are: dart, kotlin.
final
- markFilesAsGenerated → bool
-
Optional. Set
false
to not put a comment at the beginning of the generated files.final - name → String
-
Optional. Set API name for folder and export file
If not specified, the file name is used.
final
- originalHttpResponse → bool
-
DART ONLY
Optional. Set
true
to wrap all request return types with HttpResponse.final - outputDirectory → String
-
Required. Sets output directory for generated files (Clients and DTOs).
final
- putClientsInFolder → bool
-
Optional. Set
true
to put all clients in clients folder.final -
replacementRules
→ List<
ReplacementRule> -
Optional. Set regex replacement rules for the names of the generated classes/enums.
All rules are applied in order.
final
- rootClient → bool
-
DART ONLY
Optional. Set 'true' to generate root client
with interface and all clients instances.
final
- rootClientName → String?
-
DART ONLY
Optional. Set root client name.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unknownEnumValue → bool
-
DART ONLY
Optional. Set
true
to maintain backwards compatibility when adding new values on the backend.final - useFreezed3 → bool
-
Optional. Set
true
to use freezed v3 if jsonSerializer is freezed.final - useMultipartFile → bool
-
DART ONLY
Optional. Set
true
to use MultipartFile instead of File as argument type for file parameters.final
Methods
-
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