Skip to content

[vm/ffi] Remove documentation from setters #38892

@dcharkes

Description

@dcharkes

As pointed out by @lrhn

Avoid having a doc comment on both the setter and the getter, as DartDoc will show only one (the one on the getter.)

https://dart.dev/guides/language/effective-dart/documentation#prefer-starting-variable-getter-or-setter-comments-with-noun-phrases

However, the documentation of the getter does not show up when hovering the setter (at least not in VSCode).

For now, we create the dart:ffi documentation both for getter and setter, but we should remove the documentation on the setter once all IDEs properly support it.

main() {
  final zoo = Zoo();
  zoo.numAnimals = 3; // No documentation on numAnimals setter.
  print(zoo.numAnimals);
}

class Zoo {
  int _numAnimals;

  /// The [numAnimals] in the zoo.
  int get numAnimals => _numAnimals;
  void set numAnimals(int numAnimals) {
    _numAnimals = numAnimals;
  }
}

/cc @mkustermann @sjindel-google

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-ffi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions