Sitelet https://github.com/solid-software/solid_lints/issues/93
Skip to content

New rule: consider_making_a_member_private (if its not used outside) #93

Description

@danylo-safonov-solid

This'll help with dead_code

BAD:

class X {
  // only used internally 
  void x() {
    ...
  }
}

GOOD:

class X {
  // only used internally 
  void _x() {
    ...
  }
}

Activity

  1. changed the title [-]New rule: consider_making_a_field_private (if its not used outside)[/-] [+]New rule: consider_making_a_member_private (if its not used outside)[/+] on Apr 17, 2024
  2. kvenn commented on Apr 30, 2024

    @kvenn

    I'm very excited for this one! I could see it being very valuable for any class members. For some reason, Dart doesn't recognize that a member is unused unless it's private. So this would be a double whammy if it enforced all members that could be public were public.

  3. gbassisp commented on Jun 19, 2024

    @gbassisp

    Should this only be applied to class members? What about top-level ones and class definitions themselves? I think it would be worth having it to all definitions, because top-level functions that are only used internally also add noise to code completion. As a bonus, it could help us identify unused definitions (something that I used to do with dart code metrics).

  4. illia-romanenko commented on Aug 19, 2026

    @illia-romanenko
    Collaborator

    @kevmoo just published a new package that is related to this rule: https://pub.dev/packages/undead. What is proposed here is probably slightly different from this new package, but let's think about how it affects this request and whether depending on undead or other Kevin's work will make better sense.

    I also asked to add a new section of Notable 3rd party libraries to https://lints.solid.software/docs/intro @solid-illiaaihistov - Kevin's work definitely should be at least added there, as it's very relevant to what we are doing here.

  5. kevmoo commented on Aug 19, 2026

    @kevmoo

    Ooo! @illia-romanenko you gave me an IDEA.

    I bet my undead code "knows" enough to recommend to make things private. This is a GREAT idea!

  6. kevmoo commented on Aug 19, 2026

    @kevmoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions