writeFieldDeclaration abstract method

void writeFieldDeclaration(
  1. String name, {
  2. void initializerWriter()?,
  3. bool isConst = false,
  4. bool isFinal = false,
  5. bool isStatic = false,
  6. String? nameGroupName,
  7. DartType? type,
  8. String? typeGroupName,
})

Write the code for a declaration of a field with the given name. If an initializerWriter is provided, it will be invoked to write the content of the initializer. (The equal sign separating the field name from the initializer expression will automatically be written.) If isConst is true, then the declaration will be preceded by the const keyword. If isFinal is true, then the declaration will be preceded by the final keyword. (If both isConst and isFinal are true, then only the const keyword will be written.) If isStatic is true, then the declaration will be preceded by the static keyword. If a nameGroupName is provided, the name of the field will be included in the linked edit group with that name. If a type is provided, then it will be used as the type of the field. (The keyword var will be provided automatically when required.) If a typeGroupName is provided, then if a type was written it will be in the linked edit group with that name.

Implementation

void writeFieldDeclaration(String name,
    {void Function()? initializerWriter,
    bool isConst = false,
    bool isFinal = false,
    bool isStatic = false,
    String? nameGroupName,
    DartType? type,
    String? typeGroupName});