### GET /docs Source: https://pub.dev/documentation/code_builder/latest/code_builder/TypeDef/docs.html Retrieves the list of documentation strings associated with the project. ```APIDOC ## GET /docs ### Description Retrieves a collection of Dart documentation strings. ### Method GET ### Endpoint /docs ### Response #### Success Response (200) - **docs** (BuiltList) - A list of strings containing the Dart documentation. ``` -------------------------------- ### Allocate Method Usage Examples Source: https://pub.dev/documentation/code_builder/latest/code_builder/Allocator/allocate.html Demonstrates how the allocate method resolves references, including a no-op implementation and an import-prefixing implementation. ```dart allocate(const Reference('List', 'dart:core')); // Returns 'List'. ``` ```dart allocate(const Reference('Foo', 'package:foo')); // Returns '_i1.Foo'. ``` -------------------------------- ### Get Returns Property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Method/returns.html Syntax for accessing the returns property. ```text Reference? get returns; ``` -------------------------------- ### Get Method Body Source: https://pub.dev/documentation/code_builder/latest/code_builder/Constructor/body.html Use this command to retrieve the body of a method. Ensure the syntax is correct. ```text Code? get body; ``` -------------------------------- ### GET on property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Mixin/on.html Retrieves the current state or reference of the on property. ```APIDOC ## GET on ### Description Retrieves the reference for the on property. ### Method GET ### Endpoint on ### Implementation Reference? get on; ``` -------------------------------- ### GET docs property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Constructor/docs.html Retrieves the list of documentation strings associated with the project. ```APIDOC ## GET /docs ### Description Retrieves a list of Dart documentation strings. ### Method GET ### Endpoint /docs ### Response #### Success Response (200) - **docs** (BuiltList) - A list of documentation strings. ``` -------------------------------- ### GET implements property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Class/implements.html Retrieves the list of implemented references for the current code builder context. ```APIDOC ## GET /implements ### Description Returns a BuiltList of Reference objects representing the interfaces or classes implemented by the current entity. ### Method GET ### Endpoint /implements ### Response #### Success Response (200) - **implements** (BuiltList) - A list of references representing implemented types. #### Response Example { "implements": [ { "symbol": "SomeInterface" } ] } ``` -------------------------------- ### GET /constructors Source: https://pub.dev/documentation/code_builder/latest/code_builder/EnumBuilder/constructors.html Retrieves or initializes the list of constructors associated with the ListBuilder. ```APIDOC ## GET /constructors ### Description Accesses the list of Constructor objects managed by the ListBuilder. ### Method GET ### Endpoint /constructors ### Response #### Success Response (200) - **constructors** (ListBuilder) - A list of constructor objects. ### Response Example { "constructors": [] } ``` -------------------------------- ### Get Late Property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Field/late.html Use this to determine if a field should be prefixed with `late`. No specific setup or imports are required. ```dart bool get late; ``` -------------------------------- ### On Property Reference and Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/Extension/on.html This section provides the syntax for referencing and implementing the 'on property' feature, which is adaptable to different display modes. ```APIDOC ## On Property ### Description This endpoint allows referencing and implementing the 'on property' functionality, which can be toggled between dark and light modes. ### Method GET ### Endpoint /on ### Parameters #### Query Parameters - **mode** (string) - Optional - Specifies the display mode ('dark' or 'light'). Defaults to the system's current theme if not provided. ### Request Example ``` Reference? get on ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **current_mode** (string) - The active display mode ('dark' or 'light'). #### Response Example ```json { "status": "success", "current_mode": "light" } ``` ``` -------------------------------- ### Get declaredRepresentationType Property Source: https://pub.dev/documentation/code_builder/latest/code_builder/RepresentationDeclaration/declaredRepresentationType.html Reference for the getter of the declaredRepresentationType property. No specific setup is required beyond having access to this property. ```swift Reference get declaredRepresentationType; ``` -------------------------------- ### GET show property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Directive/show.html Retrieves the list of strings associated with the show property. ```APIDOC ## GET /show ### Description Retrieves the list of strings defined by the show property. ### Method GET ### Endpoint /show ### Response #### Success Response (200) - **data** (List) - A list of strings representing the show property values. #### Response Example [ "value1", "value2" ] ``` -------------------------------- ### Accept Method Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/ToCodeExpression/accept.html Details the implementation of the accept method, which is used to accept a CodeVisitor and dispatch to the appropriate visit method. ```APIDOC ## POST /websites/pub_dev_code_builder/accept ### Description This endpoint represents the 'accept' method within the Code Builder project. It is designed to accept a CodeVisitor and dispatch the visit operation to the appropriate visitor method based on the context. ### Method POST ### Endpoint /websites/pub_dev_code_builder/accept ### Parameters #### Query Parameters - **visitor** (CodeVisitor) - Required - The visitor object to process the code. - **context** (R?) - Optional - An optional context object to be passed to the visitor. ### Request Example ```json { "visitor": "visitor_implementation", "context": null } ``` ### Response #### Success Response (200) - **R** (type) - The result of the visitor's operation. #### Response Example ```json { "result": "visitor_result" } ``` ``` -------------------------------- ### Get Constant Property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Constructor/constant.html Use this getter to determine if the constructor should be prefixed with `const`. No specific setup or imports are required. ```dart bool get constant; ``` -------------------------------- ### Reference 'on' Property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Extension/on.html Use this syntax to get the 'on' property. Ensure correct semicolon placement. ```text Reference? get on; ``` -------------------------------- ### accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/BinaryExpression/accept.html The accept method accepts an ExpressionVisitor and a context, delegating the visit operation to the visitor's visitBinaryExpression method. ```APIDOC ## accept ### Description Accepts an ExpressionVisitor to process the current binary expression. ### Parameters - **visitor** (ExpressionVisitor) - Required - The visitor instance to process the expression. - **context** (R?) - Optional - An optional context object passed to the visitor. ### Implementation ```dart @override R accept(ExpressionVisitor visitor, [R? context]) => visitor.visitBinaryExpression(this, context); ``` ``` -------------------------------- ### Get All Enum Values - Dart Source: https://pub.dev/documentation/code_builder/latest/code_builder/InvokeExpressionType/values-constant.html Access the constant list of all enum values in their declaration order. No setup is required beyond defining the enum. ```dart List const values A constant List of the values in this enum, in order of their declaration. ``` -------------------------------- ### Get Comments Property Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/Library/comments.html This snippet shows the implementation of the 'comments' getter, which returns a BuiltList of Strings. Use this to access line comments defined at the library's start. ```dart BuiltList get comments; ``` -------------------------------- ### Implement accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/Mixin/accept.html This method is used to accept a visitor and pass the current instance and context to it. ```dart @override R accept(SpecVisitor visitor, [R? context]) => visitor.visitMixin(this, context); ``` -------------------------------- ### GET /initializers Source: https://pub.dev/documentation/code_builder/latest/code_builder/ConstructorBuilder/initializers.html Accesses the list of constructor initializer statements for the code builder. ```APIDOC ## GET /initializers ### Description Retrieves or sets the list of constructor initializer statements using a ListBuilder of Code objects. ### Method GET/SET ### Endpoint /initializers ### Request Example ListBuilder initializers = ListBuilder(); ### Response #### Success Response (200) - **initializers** (ListBuilder) - A list of constructor initializer statements. ``` -------------------------------- ### visitMixin Abstract Method Source: https://pub.dev/documentation/code_builder/latest/code_builder/SpecVisitor/visitMixin.html Documentation for the abstract visitMixin method, including its signature and implementation details. ```APIDOC ## visitMixin Abstract Method ### Description This is an abstract method that takes a Mixin specification and an optional context, returning a value of type T. ### Method ```dart T visitMixin(Mixin spec, [T? context]); ``` ### Implementation ```dart T visitMixin(Mixin spec, [T? context]); ``` ``` -------------------------------- ### Get Type Property Reference Source: https://pub.dev/documentation/code_builder/latest/code_builder/Field/type.html Use this syntax to reference and get the value of the 'type' property. ```plaintext Reference? get type; ``` -------------------------------- ### Get Redirect Property Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/Constructor/redirect.html This code shows how to get the redirect property. If it's non-null, it indicates a redirection to a constructor. ```dart Reference? get redirect; ``` -------------------------------- ### Define accept abstract method Source: https://pub.dev/documentation/code_builder/latest/code_builder/Spec/accept.html This method signature defines the entry point for the visitor pattern, accepting a visitor and an optional context. ```dart R accept(SpecVisitor visitor, [R? context]); ``` -------------------------------- ### ListBuilder Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/MixinBuilder/implements.html Demonstrates the implementation of the ListBuilder class for References. ```APIDOC ## ListBuilder Implementation ### Description This section details the implementation of the `ListBuilder` class, which is used for building lists of references. ### Method Implementation ### Endpoint N/A ### Parameters N/A ### Request Body N/A ### Request Example ```dart ListBuilder implements = ListBuilder(); ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### GET name property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Mixin/name.html Retrieves the name of the mixin. ```APIDOC ## GET /name ### Description Retrieves the name of the mixin. ### Method GET ### Endpoint /name ### Response #### Success Response (200) - **name** (String) - The name of the mixin. ``` -------------------------------- ### Constructor Class Overview Source: https://pub.dev/documentation/code_builder/latest/code_builder/Constructor-class.html Details about the Constructor class and its members. ```APIDOC ## Constructor Class ### Description Represents a constructor in Dart code, with properties for annotations, body, constant, docs, external, factory, initializers, lambda, name, optional parameters, and redirect. ### Properties - **annotations** (BuiltList) - Annotations as metadata on the node. - **body** (Code?) - Body of the method. - **constant** (bool) - Whether the constructor should be prefixed with `const`. - **docs** (BuiltList) - Dart docs. - **external** (bool) - Whether the constructor should be prefixed with `external`. - **factory** (bool) - Whether this constructor should be prefixed with `factory`. - **hashCode** (int) - The hash code for this object. - **initializers** (BuiltList) - Constructor initializer statements. - **lambda** (bool?) - Whether this constructor is a simple lambda expression. - **name** (String?) - Name of the constructor - optional. - **optionalParameters** (BuiltList) - Optional parameters. - **redirect** (Reference?) - If non-null, redirect to this constructor. - **requiredParameters** (BuiltList) - Required parameters. - **runtimeType** (Type) - A representation of the runtime type of the object. ### Methods - **noSuchMethod**(Invocation invocation) → dynamic - Invoked when a nonexistent method or property is accessed. - **rebuild**(dynamic updates(ConstructorBuilder)) → Constructor - Rebuilds the instance. - **toBuilder**() → ConstructorBuilder - Converts the instance to a builder `B`. - **toString**() → String - A string representation of this object. ### Operators - **operator ==**(Object other) → bool - The equality operator. ``` -------------------------------- ### String Representation Source: https://pub.dev/documentation/code_builder/latest/code_builder/LiteralMapExpression-class.html Getting the string representation of an object. ```APIDOC ## POST /expression/toString ### Description A string representation of this object. ### Method POST ### Endpoint /expression/toString ### Parameters #### Request Body - **this** (Object) - Required - The object to get the string representation of. ### Response #### Success Response (200) - **result** (String) - The string representation of the object. ### Response Example ```json { "result": "" } ``` ``` -------------------------------- ### Generate Dart Code with Scoped Dependencies Source: https://pub.dev/documentation/code_builder/latest/index.html Illustrates how to generate Dart code with automatic scoping for dependencies, using prefixes to avoid symbol conflicts. This example creates a library with two methods that return types from different packages. ```dart import 'package:code_builder/code_builder.dart'; import 'package:dart_style/dart_style.dart'; void main() { final library = Library((b) => b.body.addAll([ Method((b) => b ..body = const Code('') ..name = 'doThing' ..returns = refer('Thing', 'package:a/a.dart')), Method((b) => b ..body = const Code('') ..name = 'doOther' ..returns = refer('Other', 'package:b/b.dart')), ])); final emitter = DartEmitter.scoped(); print( DartFormatter(languageVersion: DartFormatter.latestLanguageVersion) .format('${library.accept(emitter)}'), ); } ``` ```dart import 'package:a/a.dart' as _i1; import 'package:b/b.dart' as _i2; _i1.Thing doThing() {} _i2.Other doOther() {} ``` -------------------------------- ### Implement accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/InvokeExpression/accept.html This method delegates the visit operation to the provided visitor. It requires an ExpressionVisitor implementation and an optional context. ```dart @override R accept(ExpressionVisitor visitor, [R? context]) => visitor.visitInvokeExpression(this, context); ``` -------------------------------- ### GET url property Source: https://pub.dev/documentation/code_builder/latest/code_builder/RecordType/url.html Retrieves the URL associated with the library. ```APIDOC ## GET url ### Description Returns the relative, `package:`, or `dart:` URL of the library. If the value is `null`, it indicates the "same library". ### Method GET ### Endpoint url ### Response #### Success Response (200) - **url** (String?) - The URL of the library or null. ``` -------------------------------- ### Accept Method Signature and Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/LiteralRecordExpression/accept.html This snippet shows the signature of the accept method and its implementation, which delegates the visit operation to the ExpressionVisitor. ```APIDOC ## accept method ### Description This method is part of the visitor pattern, allowing an expression to accept a visitor and perform an operation. ### Method `accept` ### Parameters - **visitor** (ExpressionVisitor) - Required - The visitor object that will perform operations on this expression. - **context** (R?) - Optional - An optional context object passed to the visitor. ### Implementation ```dart @override R accept(ExpressionVisitor visitor, [R? context]) => visitor.visitLiteralRecordExpression(this, context); ``` ### Request Example ```json { "visitor": "instance of ExpressionVisitor", "context": null } ``` ### Response #### Success Response (200) - **R** (type) - The result returned by the visitor's visit method. #### Response Example ```json { "result": "visitor_return_value" } ``` ``` -------------------------------- ### GET /body Source: https://pub.dev/documentation/code_builder/latest/code_builder/MethodBuilder/body.html Retrieves or sets the body content of a method. ```APIDOC ## GET /body ### Description Retrieves the body of the method. ### Method GET ### Endpoint /body ## PUT /body ### Description Sets the body of the method. ### Method PUT ### Endpoint /body ### Request Body - **body** (string) - Required - The implementation code for the method. ``` -------------------------------- ### Implement accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/ScopedCode/accept.html This implementation delegates the visit operation to the visitor's visitScopedCode method. ```dart @override R accept(CodeVisitor visitor, [R? context]) => visitor.visitScopedCode(this, context); ``` -------------------------------- ### Implement accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/Library/accept.html This method overrides the base implementation to call visitLibrary on the provided visitor. ```dart @override R accept(SpecVisitor visitor, [R? context]) => visitor.visitLibrary(this, context); ``` -------------------------------- ### GET /name Source: https://pub.dev/documentation/code_builder/latest/code_builder/Method/name.html Retrieves the name property of a method or function. ```APIDOC ## GET /name ### Description Retrieves the name of the method or function. Returns null if the context is a closure. ### Method GET ### Endpoint /name ### Response #### Success Response (200) - **name** (String?) - The name of the method or function, or null if it is a closure. ``` -------------------------------- ### Implement accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/CodeExpression/accept.html This method dispatches the visitor to visitCodeExpression. It requires an ExpressionVisitor and an optional context. ```dart @override R accept(ExpressionVisitor visitor, [R? context]) => visitor.visitCodeExpression(this, context); ``` -------------------------------- ### GET name property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Field/name.html Retrieves the name of the field as a string. ```APIDOC ## GET name ### Description Retrieves the name of the field. ### Method GET ### Endpoint /name ### Response #### Success Response (200) - **name** (String) - The name of the field. ``` -------------------------------- ### GET parenthesized property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Expression/parenthesized.html Retrieves the expression wrapped in parentheses. ```APIDOC ## GET parenthesized ### Description Returns the current expression wrapped in parentheses. ### Method GET ### Endpoint /parenthesized ### Implementation ```dart ParenthesizedExpression get parenthesized => ParenthesizedExpression._(this); ``` ``` -------------------------------- ### visitExtension Abstract Method Source: https://pub.dev/documentation/code_builder/latest/code_builder/SpecVisitor/visitExtension.html Details the abstract `visitExtension` method signature and its implementation. ```APIDOC ## visitExtension Abstract Method ### Description This abstract method is part of the visitor pattern, designed to handle `Extension` specifications. It allows for different implementations to process extensions with optional context. ### Method Signature ```dart T visitExtension(Extension spec, [T? context]); ``` ### Implementation ```dart T visitExtension(Extension spec, [T? context]); ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **T** (type) - The return type of the visitor method, determined by the context. #### Response Example None ``` -------------------------------- ### Implement accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/Extension/accept.html This method overrides the base implementation to call visitExtension on the provided visitor. ```dart @override R accept(SpecVisitor visitor, [R? context]) => visitor.visitExtension(this, context); ``` -------------------------------- ### GET /deferred Source: https://pub.dev/documentation/code_builder/latest/code_builder/Directive/deferred.html Retrieves the current state of the deferred property. ```APIDOC ## GET /deferred ### Description Retrieves the boolean value of the deferred property. ### Method GET ### Endpoint /deferred ### Response #### Success Response (200) - **deferred** (bool) - The current state of the deferred property. ``` -------------------------------- ### GET name property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Constructor/name.html Retrieves the optional name of the constructor. ```APIDOC ## GET name ### Description Retrieves the name of the constructor. This property is optional. ### Method GET ### Endpoint /name ### Response #### Success Response (200) - **name** (String?) - The name of the constructor, or null if not defined. ``` -------------------------------- ### Library Constructor Source: https://pub.dev/documentation/code_builder/latest/code_builder/Library/Library.html Initializes a new Library instance using a factory constructor and a builder function. ```APIDOC ## Library Constructor ### Description Creates a new instance of Library using a factory constructor. It accepts an optional function to configure the library via a LibraryBuilder. ### Parameters - **updates** (void Function(LibraryBuilder)) - Optional - A callback function used to configure the library instance. ``` -------------------------------- ### Implement accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/Reference/accept.html This implementation delegates the visit operation to the visitReference method of the provided visitor. ```dart @override R accept(SpecVisitor visitor, [R? context]) => visitor.visitReference(this, context); ``` -------------------------------- ### GET /constants/literalTrue Source: https://pub.dev/documentation/code_builder/latest/code_builder/literalTrue-constant.html Retrieves the definition and implementation details of the literalTrue constant. ```APIDOC ## GET /constants/literalTrue ### Description Represents the literal value `true` as a top-level constant expression. ### Method GET ### Endpoint /constants/literalTrue ### Implementation ```dart const Expression literalTrue = LiteralExpression._('true'); ``` ``` -------------------------------- ### GET declaredRepresentationType Source: https://pub.dev/documentation/code_builder/latest/code_builder/RepresentationDeclaration/declaredRepresentationType.html Retrieves the declared representation type for the reference object. ```APIDOC ## GET declaredRepresentationType ### Description Retrieves the declared representation type associated with the reference. ### Method GET ### Endpoint /declaredRepresentationType ### Implementation Reference get declaredRepresentationType; ``` -------------------------------- ### Method: accept Source: https://pub.dev/documentation/code_builder/latest/code_builder/Class/accept.html The accept method implements the visitor pattern, allowing a SpecVisitor to process the class instance. ```APIDOC ## accept ### Description Accepts a SpecVisitor to perform operations on the current class instance. ### Parameters - **visitor** (SpecVisitor) - Required - The visitor instance to process the class. - **context** (R?) - Optional - An optional context object passed to the visitor. ### Implementation ```dart @override R accept(SpecVisitor visitor, [R? context]) => visitor.visitClass(this, context); ``` ``` -------------------------------- ### GET /properties/toThis Source: https://pub.dev/documentation/code_builder/latest/code_builder/Parameter/toThis.html Retrieves the definition and usage context for the toThis property. ```APIDOC ## GET /properties/toThis ### Description Returns the boolean value of the toThis property, which determines if a parameter is a field formal (i.e., 'this.') in a constructor. ### Method GET ### Endpoint /properties/toThis ### Response #### Success Response (200) - **toThis** (bool) - Whether this parameter should be field formal. ``` -------------------------------- ### Implement accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/StaticCode/accept.html This implementation delegates the visit operation to the visitor's visitStaticCode method. ```dart @override R accept(CodeVisitor visitor, [R? context]) => visitor.visitStaticCode(this, context); ``` -------------------------------- ### Utility Methods Source: https://pub.dev/documentation/code_builder/latest/code_builder/TypeReference-class.html Documentation for utility methods like rebuild, toBuilder, and toString. ```APIDOC ### Utility Methods #### `rebuild(dynamic updates(TypeReferenceBuilder)) → TypeReference` - **Description**: Rebuilds the instance. - **Method**: Method - **Endpoint**: N/A #### `toBuilder() → TypeReferenceBuilder` - **Description**: Converts the instance to a builder `B`. - **Method**: Method - **Endpoint**: N/A #### `toString() → String` - **Description**: A string representation of this object. - **Method**: Method - **Endpoint**: N/A ``` -------------------------------- ### Get closure property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Method/closure.html Converts the current expression instance into a closure. ```dart Expression get closure => toClosure(this); ``` -------------------------------- ### Initialize BlockBuilder Source: https://pub.dev/documentation/code_builder/latest/code_builder/BlockBuilder/BlockBuilder.html Use the factory constructor to instantiate a BlockBuilder. ```dart factory BlockBuilder() = _$BlockBuilder; ``` -------------------------------- ### GET /comments Source: https://pub.dev/documentation/code_builder/latest/code_builder/Library/comments.html Retrieves the list of line comments configured for the library. ```APIDOC ## GET /comments ### Description Retrieves the BuiltList of strings representing the line comments to be placed at the start of the library. ### Method GET ### Endpoint /comments ### Response #### Success Response (200) - **comments** (BuiltList) - A list of strings containing the library header comments. #### Response Example { "comments": ["// Copyright 2023", "// Licensed under MIT"] } ``` -------------------------------- ### Initialize show property Source: https://pub.dev/documentation/code_builder/latest/code_builder/DirectiveBuilder/show.html Initializes the show property as an empty list of strings. ```dart List show = []; ``` -------------------------------- ### GET namedRequiredParameters Source: https://pub.dev/documentation/code_builder/latest/code_builder/FunctionTypeBuilder/namedRequiredParameters.html Retrieves or sets the namedRequiredParameters property for the MapBuilder class. ```APIDOC ## GET namedRequiredParameters ### Description Retrieves the current MapBuilder instance containing named required parameters. ### Endpoint namedRequiredParameters ### Response - **namedRequiredParameters** (MapBuilder) - The map builder instance for references. ### Implementation ```dart MapBuilder namedRequiredParameters = MapBuilder(); ``` ``` -------------------------------- ### Accept Abstract Method Source: https://pub.dev/documentation/code_builder/latest/code_builder/Code/accept.html Details of the abstract 'accept' method and its implementation signature. ```APIDOC ## abstract method accept ### Description This abstract method is part of the CodeVisitor pattern, allowing different code structures to be visited and processed. ### Method `abstract R accept(covariant CodeVisitor visitor, [R? context])` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **R** (type) - The return type of the visitor's visit method. #### Response Example None ## Implementation ```dart @override R accept(covariant CodeVisitor visitor, [R? context]); ``` ``` -------------------------------- ### GET assignment Source: https://pub.dev/documentation/code_builder/latest/code_builder/Field/assignment.html Retrieves the assignment property for the current project context. ```APIDOC ## GET assignment ### Description Retrieves the assignment field, if any, associated with the project. ### Method GET ### Endpoint /assignment ### Response #### Success Response (200) - **assignment** (string) - The assignment value associated with the project. ``` -------------------------------- ### GET annotations property Source: https://pub.dev/documentation/code_builder/latest/code_builder/ExtensionType/annotations.html Retrieves the list of annotations associated with a node. ```APIDOC ## GET annotations ### Description Retrieves the annotations defined as metadata on the node. ### Method GET ### Endpoint /annotations ### Response #### Success Response (200) - **annotations** (BuiltList) - A list of expressions representing the metadata annotations on the node. ``` -------------------------------- ### Method: startConstCode Source: https://pub.dev/documentation/code_builder/latest/code_builder/ExpressionEmitter/startConstCode.html Executes a visitor function within a context that tracks whether the current scope is a constant expression. ```APIDOC ## void startConstCode(bool isConst, Null Function() visit) ### Description Executes `visit` within a context which may alter the output if `isConst` is `true`. This allows constant expressions to omit the `const` keyword if they are already within a constant expression. ### Parameters - **isConst** (bool) - Required - Determines if the current context should be treated as a constant expression. - **visit** (Null Function()) - Required - The callback function to execute within the context. ### Implementation ```dart void startConstCode(bool isConst, Null Function() visit) { final previousConstContext = _withInConstExpression; if (isConst) { _withInConstExpression = true; } visit(); _withInConstExpression = previousConstContext; } ``` ``` -------------------------------- ### visitEnum Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/SpecVisitor/visitEnum.html Shows the signature for the implementation of the visitEnum abstract method. ```APIDOC ## Implementation of visitEnum ### Description This section provides the signature for the concrete implementation of the `visitEnum` abstract method. ### Method Signature ```dart T visitEnum(Enum spec, [T? context]); ``` ``` -------------------------------- ### GET /annotations Source: https://pub.dev/documentation/code_builder/latest/code_builder/EnumValueBuilder/annotations.html Retrieves or sets the annotations metadata associated with a node. ```APIDOC ## GET /annotations ### Description Accesses the annotations property which stores metadata as a list of expressions on the node. ### Method GET/SET ### Parameters #### Request Body - **annotations** (ListBuilder) - Required - A list of expressions representing metadata annotations. ### Request Example { "annotations": [] } ### Response #### Success Response (200) - **annotations** (ListBuilder) - The current list of metadata annotations. ``` -------------------------------- ### GET constructorName Source: https://pub.dev/documentation/code_builder/latest/code_builder/EnumValue/constructorName.html Retrieves the name of the constructor to target for code generation. ```APIDOC ## GET constructorName ### Description Returns the name of the constructor to target. If the value is null, the unnamed constructor is used. ### Property - **constructorName** (String?) - The name of the constructor to target. ### Implementation ```dart String? get constructorName; ``` ``` -------------------------------- ### ListBuilder Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/EnumBuilder/implements.html Initializes a new instance of ListBuilder for Reference objects. ```APIDOC ## ListBuilder Implementation ### Description Initializes a new instance of the ListBuilder class specifically for Reference objects. ### Implementation ```dart ListBuilder implements = ListBuilder(); ``` ``` -------------------------------- ### Extension Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/Extension/Extension.html Shows the implementation of the Extension factory constructor. ```APIDOC ## Extension Implementation ### Description This section shows the underlying implementation of the `Extension` factory constructor, which delegates to `_$ Extension`. ### Method `factory Extension([void Function(ExtensionBuilder b) updates]) = _$ Extension; ` ### Endpoint N/A (Dart class implementation) ### Parameters None ### Request Example None ### Response None ### Error Handling None ``` -------------------------------- ### GET type property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Directive/type.html Retrieves the DirectiveType associated with the current instance. ```APIDOC ## GET type ### Description Retrieves the DirectiveType of the object. ### Method GET ### Endpoint /type ### Response #### Success Response (200) - **type** (DirectiveType) - The directive type associated with the object. ``` -------------------------------- ### Implement accept method Source: https://pub.dev/documentation/code_builder/latest/code_builder/LiteralRecordExpression/accept.html This implementation delegates the visit to the visitLiteralRecordExpression method of the provided visitor. ```dart @override R accept(ExpressionVisitor visitor, [R? context]) => visitor.visitLiteralRecordExpression(this, context); ``` -------------------------------- ### GET /hide Source: https://pub.dev/documentation/code_builder/latest/code_builder/Directive/hide.html Retrieves the list of hidden properties defined in the configuration. ```APIDOC ## GET /hide ### Description Retrieves a list of strings representing properties that are currently hidden. ### Method GET ### Endpoint /hide ### Response #### Success Response (200) - **hide** (List) - A list of strings representing the hidden properties. ``` -------------------------------- ### Accept Method Signature and Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/Enum/accept.html This snippet shows the signature of the accept method and its implementation, which dispatches the call to the appropriate visitor method based on the current object's type. ```APIDOC ## accept Method ### Description The `accept` method is part of the visitor pattern. It allows an object to accept a visitor and delegate the operation to the visitor, enabling new operations to be added without modifying the object structure. ### Method `accept` ### Endpoint N/A (This is a method within a class, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart // Example of how an object might call the accept method SomeObject obj = SomeObject(); SpecVisitor visitor = MyVisitor(); obj.accept(visitor); ``` ### Response #### Success Response (200) N/A (This method returns a value of type R, determined by the visitor) #### Response Example ```dart // The return type R depends on the visitor's implementation. // For example, if R is String: String result = obj.accept(myStringVisitor); ``` ## Implementation Details ```dart @override R accept(SpecVisitor visitor, [R? context]) => visitor.visitEnum(this, context); ``` ### Implementation Description This implementation of the `accept` method takes a `SpecVisitor` and an optional `context` of type `R`. It then calls the `visitEnum` method on the provided visitor, passing `this` (the current object, presumably an enum or enum-like structure) and the `context`. ``` -------------------------------- ### GET /sealed Source: https://pub.dev/documentation/code_builder/latest/code_builder/Class/sealed.html Retrieves the boolean status indicating if a class is sealed. ```APIDOC ## GET /sealed ### Description Returns a boolean value indicating whether the class is marked as sealed. ### Method GET ### Endpoint /sealed ### Response #### Success Response (200) - **sealed** (bool) - Indicates if the class is sealed. ``` -------------------------------- ### GET constructors Source: https://pub.dev/documentation/code_builder/latest/code_builder/Class/constructors.html Retrieves the list of constructors associated with the current object. ```APIDOC ## GET constructors ### Description Retrieves a list of constructors defined for the code builder. ### Method GET ### Endpoint /constructors ### Response #### Success Response (200) - **constructors** (BuiltList) - A list of constructor objects. ``` -------------------------------- ### Object Methods Source: https://pub.dev/documentation/code_builder/latest/code_builder/InvokeExpression-class.html Documentation for general object methods like toString. ```APIDOC ## ToString ### Description A string representation of this object. ### Method GET ### Endpoint /object/tostring ``` -------------------------------- ### newInstance Method Source: https://pub.dev/documentation/code_builder/latest/code_builder/FunctionType/newInstance.html Creates a new instance of an expression with specified arguments. ```APIDOC ## Method: newInstance ### Description Returns a new instance of the expression. Note that this implementation throws an UnsupportedError when called on a function type. ### Parameters - **positionalArguments** (Iterable) - Required - The positional arguments for the instance. - **namedArguments** (Map) - Optional - The named arguments for the instance (defaults to empty). - **typeArguments** (List) - Optional - The type arguments for the instance (defaults to empty). ### Implementation ```dart @override Expression newInstance( Iterable positionalArguments, [ Map namedArguments = const {}, List typeArguments = const [], ]) => throw UnsupportedError('Cannot instantiate a function type.'); ``` ``` -------------------------------- ### GET /class/abstract Source: https://pub.dev/documentation/code_builder/latest/code_builder/Class/abstract.html Retrieves the boolean status indicating if a class is abstract. ```APIDOC ## GET /class/abstract ### Description Returns a boolean value indicating whether the class is defined as abstract. ### Method GET ### Endpoint /class/abstract ### Response #### Success Response (200) - **abstract** (bool) - True if the class is abstract, false otherwise. #### Response Example { "abstract": true } ``` -------------------------------- ### GET /annotations Source: https://pub.dev/documentation/code_builder/latest/code_builder/RepresentationDeclarationBuilder/annotations.html Retrieves or sets the list of annotations associated with a code node. ```APIDOC ## GET /annotations ### Description Retrieves the current list of annotations defined as metadata on the node. ### Method GET ### Endpoint /annotations ### Response #### Success Response (200) - **annotations** (ListBuilder) - A list of expressions representing the metadata annotations. ## PUT /annotations ### Description Updates the list of annotations for the node. ### Method PUT ### Endpoint /annotations ### Request Body - **annotations** (ListBuilder) - Required - The new list of expressions to be set as annotations. ``` -------------------------------- ### Implement startConstCode Method Source: https://pub.dev/documentation/code_builder/latest/code_builder/ExpressionEmitter/startConstCode.html Executes a visit function within a context that may alter output if isConst is true. This enables constant expressions to omit the 'const' keyword if they are already within a constant expression. Resets the context after execution. ```dart void startConstCode(bool isConst, Null Function() visit) { final previousConstContext = _withInConstExpression; if (isConst) { _withInConstExpression = true; } visit(); _withInConstExpression = previousConstContext; } ``` -------------------------------- ### GET positionalFieldTypes Source: https://pub.dev/documentation/code_builder/latest/code_builder/RecordType/positionalFieldTypes.html Retrieves the list of positional field types defined in the project. ```APIDOC ## GET positionalFieldTypes ### Description Retrieves a list of references representing the positional field types. ### Method GET ### Endpoint /positionalFieldTypes ### Response #### Success Response (200) - **positionalFieldTypes** (BuiltList) - A list of references representing the positional field types. ``` -------------------------------- ### Implement Accept Abstract Method Source: https://pub.dev/documentation/code_builder/latest/code_builder/Code/accept.html This is the abstract method signature that concrete visitors must implement. It accepts a visitor and an optional context. ```dart @override R accept(covariant CodeVisitor visitor, [R? context]); ``` -------------------------------- ### Get named property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Parameter/named.html Retrieves the boolean value indicating if a parameter is named. ```dart bool get named; ``` -------------------------------- ### visitRecordType Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/SpecVisitor/visitRecordType.html Details on the implementation of the visitRecordType method. ```APIDOC ## Implementation of visitRecordType ### Description This section details the concrete implementation signature for the `visitRecordType` method. ### Method Abstract Method Implementation ### Endpoint N/A (Abstract Method Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart T visitRecordType(RecordType spec, [T? context]); ``` ### Response #### Success Response (200) Returns a value of type `T`. #### Response Example ```dart // Example return value from implementation T result = ...; ``` ``` -------------------------------- ### Implement refer function Source: https://pub.dev/documentation/code_builder/latest/code_builder/refer.html Creates a Reference instance using the provided symbol and optional URL. ```dart Reference refer(String symbol, [String? url]) => Reference(symbol, url); ``` -------------------------------- ### GET /base Source: https://pub.dev/documentation/code_builder/latest/code_builder/Mixin/base.html Retrieves the boolean value indicating if the mixin is a base mixin. ```APIDOC ## GET /base ### Description Returns a boolean value indicating whether the current mixin is a `base mixin`. ### Method GET ### Endpoint /base ### Response #### Success Response (200) - **base** (bool) - Returns true if the mixin is a base mixin, false otherwise. ``` -------------------------------- ### GET /MethodModifier/values Source: https://pub.dev/documentation/code_builder/latest/code_builder/MethodModifier/values-constant.html Retrieves the constant list of all values defined in the MethodModifier enum. ```APIDOC ## GET /MethodModifier/values ### Description Returns a constant List of the values in the MethodModifier enum, ordered by their declaration. ### Method GET ### Endpoint /MethodModifier/values ### Response #### Success Response (200) - **values** (List) - A list of all enum members in order of declaration. ``` -------------------------------- ### ExpressionVisitor Constructor Source: https://pub.dev/documentation/code_builder/latest/code_builder/ExpressionVisitor/ExpressionVisitor.html Initializes a new instance of the ExpressionVisitor class. ```APIDOC ## ExpressionVisitor Constructor ### Description Initializes a new instance of the ExpressionVisitor class. ### Method Constructor ### Endpoint N/A ### Parameters This constructor does not take any parameters. ### Request Example N/A ### Response N/A ``` -------------------------------- ### GET requiredParameters Source: https://pub.dev/documentation/code_builder/latest/code_builder/Method/requiredParameters.html Retrieves the list of required parameters for the code builder configuration. ```APIDOC ## GET /requiredParameters ### Description Returns a list of mandatory parameters required for the code builder process. ### Method GET ### Endpoint /requiredParameters ### Response #### Success Response (200) - **requiredParameters** (BuiltList) - A list of Parameter objects representing the required inputs. ``` -------------------------------- ### visitConstructor Abstract Method Source: https://pub.dev/documentation/code_builder/latest/code_builder/SpecVisitor/visitConstructor.html Documentation for the abstract `visitConstructor` method used in code construction. ```APIDOC ## visitConstructor abstract method ### Description This abstract method is designed to visit and construct code elements, specifically constructors, within a given class context. ### Method Abstract Method ### Endpoint N/A (This is an abstract method, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **spec** (Constructor) - Required - The constructor specification to visit. - **clazz** (String) - Required - The name of the class where the constructor is defined. - **context** (T?) - Optional - An optional context object of type T. ### Request Example ```dart // Example of how this method might be called (implementation specific) // T result = visitor.visitConstructor(myConstructorSpec, 'MyClass', myContext); ``` ### Response #### Success Response (Return Type T) - **T** - The result of visiting the constructor, potentially modified by the context. #### Response Example ```dart // Example return value (implementation specific) // return someValueOfTypeT; ``` ## Implementation ```dart T visitConstructor(Constructor spec, String clazz, [T? context]); ``` ``` -------------------------------- ### Get Returns Property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Method/returns.html This endpoint allows you to retrieve information about the 'returns property'. ```APIDOC ## GET /returns ### Description Retrieves information about the 'returns property'. ### Method GET ### Endpoint /returns ### Parameters #### Query Parameters - **Reference** (string) - Optional - Specifies a reference for the property. ### Response #### Success Response (200) - **property_info** (object) - Details about the returned property. #### Response Example ```json { "property_info": { "name": "example_property", "type": "string", "description": "An example property." } } ``` ``` -------------------------------- ### GET /InvokeExpressionType/values Source: https://pub.dev/documentation/code_builder/latest/code_builder/InvokeExpressionType/values-constant.html Retrieves the constant list of all values defined in the InvokeExpressionType enum. ```APIDOC ## GET /InvokeExpressionType/values ### Description Returns a constant List of the values in the InvokeExpressionType enum, ordered by their declaration. ### Method GET ### Endpoint /InvokeExpressionType/values ### Response #### Success Response (200) - **values** (List) - A constant list of enum values in order of declaration. #### Response Example [ "value1", "value2", "value3" ] ``` -------------------------------- ### Methods Property Source: https://pub.dev/documentation/code_builder/latest/code_builder/Class/methods.html Retrieves a list of available methods. ```APIDOC ## GET /methods ### Description Retrieves a list of available methods. ### Method GET ### Endpoint /methods ### Parameters None ### Request Body None ### Response #### Success Response (200) - **methods** (BuiltList) - A list of Method objects. #### Response Example ```json { "methods": [ { "name": "exampleMethod1", "description": "This is an example method." }, { "name": "exampleMethod2", "description": "Another example method." } ] } ``` ``` -------------------------------- ### GET namedRequiredParameters Source: https://pub.dev/documentation/code_builder/latest/code_builder/FunctionType/namedRequiredParameters.html Retrieves the map of named required parameters for a function type. ```APIDOC ## GET namedRequiredParameters ### Description Retrieves the named required parameters of this function type as a map of references. ### Endpoint namedRequiredParameters ### Response - **namedRequiredParameters** (BuiltMap) - A map where keys are parameter names and values are their corresponding references. ``` -------------------------------- ### Reference Constructors Source: https://pub.dev/documentation/code_builder/latest/code_builder/Reference-class.html Details on how to construct a Reference object. ```APIDOC ## Constructors Reference(String? symbol, [String? url]) Create a reference to `symbol` in `url`. const ``` -------------------------------- ### Get RepresentationDeclaration Property Source: https://pub.dev/documentation/code_builder/latest/code_builder/ExtensionType/representationDeclaration.html Retrieves the RepresentationDeclaration property. This is a basic getter declaration. ```csharp RepresentationDeclaration get representationDeclaration; ``` -------------------------------- ### Initialize Library with factory constructor Source: https://pub.dev/documentation/code_builder/latest/code_builder/Library/Library.html Use this factory constructor to create a new Library instance, optionally applying updates via a LibraryBuilder. ```dart factory Library([void Function(LibraryBuilder) updates]) = _$Library; ``` -------------------------------- ### Build Abstract Method Source: https://pub.dev/documentation/code_builder/latest/code_builder/ConstructorBuilder/build.html Details about the abstract build method, including its constructor and generated implementation. ```APIDOC ## Build Abstract Method ### Description This abstract method is intended to be implemented by subclasses. Its implementation is automatically generated by the `built_value` package. ### Constructor `build()` ### Inherited This method is inherited from a base class. ### Implementation ```dart V build(); ``` This method is responsible for constructing an immutable value. The `built_value` generator handles the actual creation of the build logic based on the defined structure. ``` -------------------------------- ### GET primaryConstructorName Source: https://pub.dev/documentation/code_builder/latest/code_builder/ExtensionType/primaryConstructorName.html Retrieves the name of the extension type's primary constructor. ```APIDOC ## GET primaryConstructorName ### Description Returns the name of the extension type's primary constructor. If the constructor is unnamed, this returns an empty string. ### Method GET ### Response - **primaryConstructorName** (String) - The name of the primary constructor or an empty string if unnamed. ``` -------------------------------- ### accept abstract method Source: https://pub.dev/documentation/code_builder/latest/code_builder/Expression/accept.html This section describes the abstract 'accept' method, which is part of the ExpressionVisitor pattern. ```APIDOC ## accept abstract method ### Description This is an abstract method that accepts an ExpressionVisitor and an optional context. It is intended to be overridden by concrete implementations. ### Method `accept` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ## Implementation ### Description This shows the typical implementation signature for the abstract `accept` method. ### Method `override R accept(covariant ExpressionVisitor visitor, [R? context])` ### Endpoint N/A (This is a method signature, not an API endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart @override R accept(covariant ExpressionVisitor visitor, [R? context]) { // Implementation details here } ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Allocator Constructors Source: https://pub.dev/documentation/code_builder/latest/code_builder/Allocator-class.html Information about how to create new instances of the Allocator class. ```APIDOC ## Allocator() ### Description Creates a new default allocator that applies no prefixing. ### Method Constructor ### Endpoint N/A ### Parameters None ### Request Example ```dart var allocator = Allocator(); ``` ### Response N/A ``` ```APIDOC ## Allocator.simplePrefixing() ### Description Creates a new allocator that applies naive prefixing to avoid conflicts. ### Method Factory Constructor ### Endpoint N/A ### Parameters None ### Request Example ```dart var allocator = Allocator.simplePrefixing(); ``` ### Response N/A ``` -------------------------------- ### GET requiredParameters Source: https://pub.dev/documentation/code_builder/latest/code_builder/Constructor/requiredParameters.html Retrieves the list of required parameters for the code builder implementation. ```APIDOC ## GET /requiredParameters ### Description Returns a list of required parameters for the code builder. ### Method GET ### Endpoint /requiredParameters ### Response #### Success Response (200) - **requiredParameters** (BuiltList) - A list of mandatory parameters. ``` -------------------------------- ### Directive Constructor and Implementation Source: https://pub.dev/documentation/code_builder/latest/code_builder/Directive/Directive.html Details the Directive constructor, including its factory method and how it's implemented. ```APIDOC ## Directive Constructor ### Description Represents a directive with an optional update function. ### Method `Directive.new` (factory constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ## Directive Implementation ### Description Provides the implementation for the Directive factory constructor. ### Method `factory Directive([void Function(DirectiveBuilder) updates])` ### Endpoint None ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart factory Directive([void Function(DirectiveBuilder) updates]) = _$Directive; ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### GET optionalParameters Source: https://pub.dev/documentation/code_builder/latest/code_builder/Constructor/optionalParameters.html Retrieves the list of optional parameters defined for the code builder. ```APIDOC ## GET optionalParameters ### Description Retrieves the collection of optional parameters associated with the current configuration. ### Response - **optionalParameters** (BuiltList) - A list of optional parameters. ```