ConstructorDeclarationImpl constructor

ConstructorDeclarationImpl({
  1. required CommentImpl? comment,
  2. required List<AnnotationImpl>? metadata,
  3. required Token? externalKeyword,
  4. required Token? constKeyword,
  5. required Token? factoryKeyword,
  6. required IdentifierImpl returnType,
  7. required Token? period,
  8. required Token? name,
  9. required FormalParameterListImpl parameters,
  10. required Token? separator,
  11. required List<ConstructorInitializerImpl>? initializers,
  12. required ConstructorNameImpl? redirectedConstructor,
  13. required FunctionBodyImpl body,
})

Initialize a newly created constructor declaration. The externalKeyword can be null if the constructor is not external. Either or both of the comment and metadata can be null if the constructor does not have the corresponding attribute. The constKeyword can be null if the constructor cannot be used to create a constant. The factoryKeyword can be null if the constructor is not a factory. The period and name can both be null if the constructor is not a named constructor. The separator can be null if the constructor does not have any initializers and does not redirect to a different constructor. The list of initializers can be null if the constructor does not have any initializers. The redirectedConstructor can be null if the constructor does not redirect to a different constructor. The body can be null if the constructor does not have a body.

Implementation

ConstructorDeclarationImpl({
  required super.comment,
  required super.metadata,
  required this.externalKeyword,
  required this.constKeyword,
  required this.factoryKeyword,
  required IdentifierImpl returnType,
  required this.period,
  required this.name,
  required FormalParameterListImpl parameters,
  required this.separator,
  required List<ConstructorInitializerImpl>? initializers,
  required ConstructorNameImpl? redirectedConstructor,
  required FunctionBodyImpl body,
})  : _returnType = returnType,
      _parameters = parameters,
      _redirectedConstructor = redirectedConstructor,
      _body = body {
  _becomeParentOf(_returnType);
  _becomeParentOf(_parameters);
  _initializers._initialize(this, initializers);
  _becomeParentOf(_redirectedConstructor);
  _becomeParentOf(_body);
}