writeType abstract method

bool writeType(
  1. DartType? type, {
  2. bool addSupertypeProposals = false,
  3. String? groupName,
  4. ExecutableElement? methodBeingCopied,
  5. bool required = false,
})

Write the code for a type annotation for the given type. If the type is either null or represents the type 'dynamic', then the behavior depends on whether a type is required. If required is true, then 'var' will be written; otherwise, nothing is written.

If the groupName is not null, then the name of the type (including type parameters) will be included as a region in the linked edit group with that name. If the groupName is not null and addSupertypeProposals is true, then all of the supertypes of the type will be added as suggestions for alternatives to the type name.

If a methodBeingCopied is provided, then type parameters defined by that method are assumed to be part of what is being written and hence valid types.

Return true if some text was written.

Implementation

bool writeType(DartType? type,
    {bool addSupertypeProposals = false,
    String? groupName,
    ExecutableElement? methodBeingCopied,
    bool required = false});